Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

rust: Follow-up fixes for attribute highlighting (#26172)

Finn Everse9b4fa146509
diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm
index f52b8f1f901..34380f0d3bf 100644
--- a/crates/languages/src/rust/highlights.scm
+++ b/crates/languages/src/rust/highlights.scm
@@ -190,9 +190,15 @@ operator: "/" @operator
(parameter (identifier) @variable.parameter)
-(attribute_item (attribute (identifier) @attribute))
-(inner_attribute_item (attribute (identifier) @attribute))
+(attribute_item (attribute [
+ (identifier) @attribute
+ (scoped_identifier name: (identifier) @attribute)
+]))
+(inner_attribute_item (attribute [
+ (identifier) @attribute
+ (scoped_identifier name: (identifier) @attribute)
+]))
; Match nested snake case identifiers in attribute items.
(token_tree (identifier) @attribute (#match? @attribute "^[a-z\\d_]*$"))
-; Override the attribute match for paths in scoped identifiers.
-(token_tree (identifier) @variable "::")
+; Override the attribute match for paths in scoped type/enum identifiers.
+(token_tree (identifier) @variable "::" (identifier) @type (#match? @type "^[A-Z]"))