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.

python: Fix at sign decorator highlighting conflict with matrix multiplication at sign operator (#58077)

Alex Lachance250b6581b5b3
diff --git a/crates/grammars/src/python/highlights.scm b/crates/grammars/src/python/highlights.scm
index 7641cef1179..cf2fb39762d 100644
--- a/crates/grammars/src/python/highlights.scm
+++ b/crates/grammars/src/python/highlights.scm
@@ -46,18 +46,17 @@
function: (identifier) @function.call)
(decorator
- "@" @punctuation.special)
-
-(decorator
- "@" @punctuation.special
+ "@" @function.decorator
[
(identifier) @function.decorator
(attribute
+ object: (identifier) @function.decorator
attribute: (identifier) @function.decorator)
(call
function: (identifier) @function.decorator.call)
(call
(attribute
+ object: (identifier) @function.decorator.call
attribute: (identifier) @function.decorator.call))
])
@@ -257,7 +256,6 @@
"&"
"%"
"%="
- "@"
"^"
"+"
"->"
@@ -282,6 +280,9 @@
"|="
] @operator
+(binary_operator
+ operator: "@" @operator)
+
[
"and"
"in"
@@ -335,8 +336,9 @@
] @keyword.definition
(decorator
- (identifier) @attribute.builtin
- (#any-of? @attribute.builtin "classmethod" "staticmethod" "property"))
+ "@" @attribute.builtin
+ (identifier) @attribute.builtin @_decorator
+ (#any-of? @_decorator "classmethod" "staticmethod" "property"))
(attribute
attribute: (identifier) @attribute.special