mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
fix: Fix nested macro diagnostics pointing at macro expansion files
This commit is contained in:
parent
52bc15fc1f
commit
dc8254c6ab
4 changed files with 25 additions and 19 deletions
|
@ -5,10 +5,7 @@ use crate::{Diagnostic, DiagnosticsContext};
|
|||
// This diagnostic is shown for macro expansion errors.
|
||||
pub(crate) fn macro_error(ctx: &DiagnosticsContext<'_>, d: &hir::MacroError) -> Diagnostic {
|
||||
// Use more accurate position if available.
|
||||
let display_range = d
|
||||
.precise_location
|
||||
.unwrap_or_else(|| ctx.sema.diagnostics_display_range(d.node.clone()).range);
|
||||
|
||||
let display_range = ctx.resolve_precise_location(&d.node, d.precise_location);
|
||||
Diagnostic::new("macro-error", d.message.clone(), display_range).experimental()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue