]> git.lizzy.rs Git - rust.git/commitdiff
fix: Add highlighting hack back for unresolved attributes
authorLukas Wirth <lukastw97@gmail.com>
Sun, 5 Dec 2021 10:59:07 +0000 (11:59 +0100)
committerLukas Wirth <lukastw97@gmail.com>
Sun, 5 Dec 2021 10:59:07 +0000 (11:59 +0100)
crates/ide/src/syntax_highlighting/highlight.rs

index 88c469df2655fe59126cd1beb7d400ae04c48a22..a52b2247c5abae7040063b6d61f2c2bcb107389d 100644 (file)
@@ -262,6 +262,13 @@ fn highlight_name_ref(
         None if name_ref.self_token().is_some() && is_in_fn_with_self_param(&name_ref) => {
             return SymbolKind::SelfParam.into()
         }
+        // FIXME: This is required for helper attributes used by proc-macros, as those do not map down
+        // to anything when used.
+        // 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) => {
+            return HlTag::Symbol(SymbolKind::Attribute).into();
+        }
         None => return HlTag::UnresolvedReference.into(),
     };
     let mut h = match name_class {