mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
More accurately place proc-macro diagnostic
This commit is contained in:
parent
0432aa0ed7
commit
d171838d63
4 changed files with 49 additions and 9 deletions
|
@ -143,11 +143,13 @@ pub(crate) fn diagnostics(
|
|||
);
|
||||
})
|
||||
.on::<hir::diagnostics::UnresolvedProcMacro, _>(|d| {
|
||||
// Use more accurate position if available.
|
||||
let display_range =
|
||||
d.precise_location.unwrap_or_else(|| sema.diagnostics_display_range(d).range);
|
||||
|
||||
// FIXME: it would be nice to tell the user whether proc macros are currently disabled
|
||||
res.borrow_mut().push(
|
||||
Diagnostic::hint(sema.diagnostics_display_range(d).range, d.message())
|
||||
.with_code(Some(d.code())),
|
||||
);
|
||||
res.borrow_mut()
|
||||
.push(Diagnostic::hint(display_range, d.message()).with_code(Some(d.code())));
|
||||
})
|
||||
// Only collect experimental diagnostics when they're enabled.
|
||||
.filter(|diag| !(diag.is_experimental() && config.disable_experimental))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue