diff options
author | Aleksey Kladov <[email protected]> | 2021-02-28 11:12:11 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-02-28 11:29:10 +0000 |
commit | 05729fd3c4aa542d162b54e7352c0d4bade62684 (patch) | |
tree | 5e0c37057750cc897031a02ec4860462a4cea9ef /crates/hir_def/src/nameres.rs | |
parent | c412d5f8d13cd55dc1873fb55e742a317c7846a8 (diff) |
For unresolved macros, hightlight only the last segment
Diffstat (limited to 'crates/hir_def/src/nameres.rs')
-rw-r--r-- | crates/hir_def/src/nameres.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index f92232eb3..6a3456f2e 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs | |||
@@ -417,6 +417,8 @@ mod diagnostics { | |||
417 | 417 | ||
418 | UnresolvedProcMacro { ast: MacroCallKind }, | 418 | UnresolvedProcMacro { ast: MacroCallKind }, |
419 | 419 | ||
420 | UnresolvedMacroCall { ast: AstId<ast::MacroCall> }, | ||
421 | |||
420 | MacroError { ast: MacroCallKind, message: String }, | 422 | MacroError { ast: MacroCallKind, message: String }, |
421 | } | 423 | } |
422 | 424 | ||
@@ -477,6 +479,13 @@ mod diagnostics { | |||
477 | Self { in_module: container, kind: DiagnosticKind::MacroError { ast, message } } | 479 | Self { in_module: container, kind: DiagnosticKind::MacroError { ast, message } } |
478 | } | 480 | } |
479 | 481 | ||
482 | pub(super) fn unresolved_macro_call( | ||
483 | container: LocalModuleId, | ||
484 | ast: AstId<ast::MacroCall>, | ||
485 | ) -> Self { | ||
486 | Self { in_module: container, kind: DiagnosticKind::UnresolvedMacroCall { ast } } | ||
487 | } | ||
488 | |||
480 | pub(super) fn add_to( | 489 | pub(super) fn add_to( |
481 | &self, | 490 | &self, |
482 | db: &dyn DefDatabase, | 491 | db: &dyn DefDatabase, |
@@ -589,6 +598,11 @@ mod diagnostics { | |||
589 | }); | 598 | }); |
590 | } | 599 | } |
591 | 600 | ||
601 | DiagnosticKind::UnresolvedMacroCall { ast } => { | ||
602 | let node = ast.to_node(db.upcast()); | ||
603 | sink.push(UnresolvedMacroCall { file: ast.file_id, node: AstPtr::new(&node) }); | ||
604 | } | ||
605 | |||
592 | DiagnosticKind::MacroError { ast, message } => { | 606 | DiagnosticKind::MacroError { ast, message } => { |
593 | let (file, ast) = match ast { | 607 | let (file, ast) = match ast { |
594 | MacroCallKind::FnLike(ast) => { | 608 | MacroCallKind::FnLike(ast) => { |