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: Restore and update attribute highlighting (#25501)

Finn Evers113c471bb0ae
diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm
index 36e94ad2508..f52b8f1f901 100644
--- a/crates/languages/src/rust/highlights.scm
+++ b/crates/languages/src/rust/highlights.scm
@@ -190,5 +190,9 @@ operator: "/" @operator
(parameter (identifier) @variable.parameter)
-(attribute_item) @attribute
-(inner_attribute_item) @attribute
+(attribute_item (attribute (identifier) @attribute))
+(inner_attribute_item (attribute (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 "::")