This commit is contained in:
Lukas Wirth 2023-12-06 14:36:39 +01:00
parent 9cb13b6efb
commit 634d588fd7
13 changed files with 137 additions and 176 deletions

View file

@ -1,6 +1,6 @@
//! Computes color for a single element.
use hir::{AsAssocItem, HasVisibility, HirFileIdExt, Semantics};
use hir::{AsAssocItem, HasVisibility, MacroFileIdExt, Semantics};
use ide_db::{
defs::{Definition, IdentClass, NameClass, NameRefClass},
FxHashMap, RootDatabase, SymbolKind,
@ -218,7 +218,10 @@ fn highlight_name_ref(
// We can fix this for derive attributes since derive helpers are recorded, but not for
// general attributes.
None if name_ref.syntax().ancestors().any(|it| it.kind() == ATTR)
&& !sema.hir_file_for(name_ref.syntax()).is_derive_attr_pseudo_expansion(sema.db) =>
&& !sema
.hir_file_for(name_ref.syntax())
.macro_file()
.map_or(false, |it| it.is_derive_attr_pseudo_expansion(sema.db)) =>
{
return HlTag::Symbol(SymbolKind::Attribute).into();
}