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/src/diagnostics.rs | 4 +++- crates/hir/src/semantics.rs | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/hir/src') diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs index 5343a036c..b1ebba516 100644 --- a/crates/hir/src/diagnostics.rs +++ b/crates/hir/src/diagnostics.rs @@ -1,5 +1,7 @@ //! FIXME: write short doc here -pub use hir_def::diagnostics::{InactiveCode, UnresolvedModule, UnresolvedProcMacro}; +pub use hir_def::diagnostics::{ + InactiveCode, UnresolvedMacroCall, UnresolvedModule, UnresolvedProcMacro, +}; pub use hir_expand::diagnostics::{ Diagnostic, DiagnosticCode, DiagnosticSink, DiagnosticSinkBuilder, }; diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 59292d5a2..144851f83 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -16,13 +16,12 @@ use rustc_hash::{FxHashMap, FxHashSet}; use syntax::{ algo::find_node_at_offset, ast::{self, GenericParamsOwner, LoopBodyOwner}, - match_ast, AstNode, SyntaxNode, SyntaxToken, TextSize, + match_ast, AstNode, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextSize, }; use crate::{ code_model::Access, db::HirDatabase, - diagnostics::Diagnostic, semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx}, source_analyzer::{resolve_hir_path, SourceAnalyzer}, AssocItem, Callable, ConstParam, Crate, Field, Function, HirFileId, Impl, InFile, Label, @@ -141,7 +140,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { self.imp.original_range(node) } - pub fn diagnostics_display_range(&self, diagnostics: &dyn Diagnostic) -> FileRange { + pub fn diagnostics_display_range(&self, diagnostics: InFile) -> FileRange { self.imp.diagnostics_display_range(diagnostics) } @@ -385,8 +384,7 @@ impl<'db> SemanticsImpl<'db> { node.as_ref().original_file_range(self.db.upcast()) } - fn diagnostics_display_range(&self, diagnostics: &dyn Diagnostic) -> FileRange { - let src = diagnostics.display_source(); + fn diagnostics_display_range(&self, src: InFile) -> FileRange { let root = self.db.parse_or_expand(src.file_id).unwrap(); let node = src.value.to_node(&root); self.cache(root, src.file_id); -- cgit v1.2.3