diff options
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/diagnostics.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 8b4ceb9a1..9d3d88289 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs | |||
@@ -143,11 +143,13 @@ pub(crate) fn diagnostics( | |||
143 | ); | 143 | ); |
144 | }) | 144 | }) |
145 | .on::<hir::diagnostics::UnresolvedProcMacro, _>(|d| { | 145 | .on::<hir::diagnostics::UnresolvedProcMacro, _>(|d| { |
146 | // Use more accurate position if available. | ||
147 | let display_range = | ||
148 | d.precise_location.unwrap_or_else(|| sema.diagnostics_display_range(d).range); | ||
149 | |||
146 | // FIXME: it would be nice to tell the user whether proc macros are currently disabled | 150 | // FIXME: it would be nice to tell the user whether proc macros are currently disabled |
147 | res.borrow_mut().push( | 151 | res.borrow_mut() |
148 | Diagnostic::hint(sema.diagnostics_display_range(d).range, d.message()) | 152 | .push(Diagnostic::hint(display_range, d.message()).with_code(Some(d.code()))); |
149 | .with_code(Some(d.code())), | ||
150 | ); | ||
151 | }) | 153 | }) |
152 | // Only collect experimental diagnostics when they're enabled. | 154 | // Only collect experimental diagnostics when they're enabled. |
153 | .filter(|diag| !(diag.is_experimental() && config.disable_experimental)) | 155 | .filter(|diag| !(diag.is_experimental() && config.disable_experimental)) |