aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics/unresolved_proc_macro.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-06-14 11:15:05 +0100
committerAleksey Kladov <[email protected]>2021-06-14 15:45:17 +0100
commit1d2772c2c7dc0a42d8a9429d24ea41412add61b3 (patch)
tree2e727c6465f972b7f62857bc1143e08f4b4416d4 /crates/ide/src/diagnostics/unresolved_proc_macro.rs
parent3d2f0400a26ef6b07d61a06e1b543072b627570e (diff)
internal: move diagnostics to a new crate
Diffstat (limited to 'crates/ide/src/diagnostics/unresolved_proc_macro.rs')
-rw-r--r--crates/ide/src/diagnostics/unresolved_proc_macro.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/crates/ide/src/diagnostics/unresolved_proc_macro.rs b/crates/ide/src/diagnostics/unresolved_proc_macro.rs
deleted file mode 100644
index 3dc6ab451..000000000
--- a/crates/ide/src/diagnostics/unresolved_proc_macro.rs
+++ /dev/null
@@ -1,30 +0,0 @@
1use crate::{
2 diagnostics::{Diagnostic, DiagnosticsContext},
3 Severity,
4};
5
6// Diagnostic: unresolved-proc-macro
7//
8// This diagnostic is shown when a procedural macro can not be found. This usually means that
9// procedural macro support is simply disabled (and hence is only a weak hint instead of an error),
10// but can also indicate project setup problems.
11//
12// If you are seeing a lot of "proc macro not expanded" warnings, you can add this option to the
13// `rust-analyzer.diagnostics.disabled` list to prevent them from showing. Alternatively you can
14// enable support for procedural macros (see `rust-analyzer.procMacro.enable`).
15pub(super) fn unresolved_proc_macro(
16 ctx: &DiagnosticsContext<'_>,
17 d: &hir::UnresolvedProcMacro,
18) -> Diagnostic {
19 // Use more accurate position if available.
20 let display_range = d
21 .precise_location
22 .unwrap_or_else(|| ctx.sema.diagnostics_display_range(d.node.clone()).range);
23 // FIXME: it would be nice to tell the user whether proc macros are currently disabled
24 let message = match &d.macro_name {
25 Some(name) => format!("proc macro `{}` not expanded", name),
26 None => "proc macro not expanded".to_string(),
27 };
28
29 Diagnostic::new("unresolved-proc-macro", message, display_range).severity(Severity::WeakWarning)
30}