aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics.rs
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-11-27 15:29:40 +0000
committerJonas Schievink <[email protected]>2020-11-27 15:29:40 +0000
commitd171838d63907d004ab935d6564bfeb4238d5540 (patch)
tree5c8d1a42cedda2027a6214727e4ad7cd4ffc4fa9 /crates/ide/src/diagnostics.rs
parent0432aa0ed7be3f41d41928499abc688a956214cf (diff)
More accurately place proc-macro diagnostic
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r--crates/ide/src/diagnostics.rs10
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))