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: Improve highlighting within macros (#37049)

Finn Evers9a97f9465b08
diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm
index 1c46061827c..3f44c5fc0e4 100644
--- a/crates/languages/src/rust/highlights.scm
+++ b/crates/languages/src/rust/highlights.scm
@@ -195,12 +195,13 @@ operator: "/" @operator
(attribute_item (attribute [
(identifier) @attribute
(scoped_identifier name: (identifier) @attribute)
+ (token_tree (identifier) @attribute (#match? @attribute "^[a-z\\d_]*$"))
+ (token_tree (identifier) @variable "::" (identifier) @type (#match? @type "^[A-Z]"))
]))
+
(inner_attribute_item (attribute [
(identifier) @attribute
(scoped_identifier name: (identifier) @attribute)
+ (token_tree (identifier) @attribute (#match? @attribute "^[a-z\\d_]*$"))
+ (token_tree (identifier) @variable "::" (identifier) @type (#match? @type "^[A-Z]"))
]))
-; 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 type/enum identifiers.
-(token_tree (identifier) @variable "::" (identifier) @type (#match? @type "^[A-Z]"))