From 05729fd3c4aa542d162b54e7352c0d4bade62684 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Feb 2021 14:12:11 +0300 Subject: For unresolved macros, hightlight only the last segment --- crates/hir_def/src/diagnostics.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'crates/hir_def/src/diagnostics.rs') diff --git a/crates/hir_def/src/diagnostics.rs b/crates/hir_def/src/diagnostics.rs index ab3f059ce..ac7474f63 100644 --- a/crates/hir_def/src/diagnostics.rs +++ b/crates/hir_def/src/diagnostics.rs @@ -95,6 +95,34 @@ impl Diagnostic for UnresolvedImport { } } +// Diagnostic: unresolved-macro-call +// +// This diagnostic is triggered if rust-analyzer is unable to resolove path to a +// macro in a macro invocation. +#[derive(Debug)] +pub struct UnresolvedMacroCall { + pub file: HirFileId, + pub node: AstPtr, +} + +impl Diagnostic for UnresolvedMacroCall { + fn code(&self) -> DiagnosticCode { + DiagnosticCode("unresolved-macro-call") + } + fn message(&self) -> String { + "unresolved macro call".to_string() + } + fn display_source(&self) -> InFile { + InFile::new(self.file, self.node.clone().into()) + } + fn as_any(&self) -> &(dyn Any + Send + 'static) { + self + } + fn is_experimental(&self) -> bool { + true + } +} + // Diagnostic: inactive-code // // This diagnostic is shown for code with inactive `#[cfg]` attributes. -- cgit v1.2.3