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 incorrect highlighting of function parameters (#26815)

Finn Everse42406f9d5d6
diff --git a/crates/languages/src/python/highlights.scm b/crates/languages/src/python/highlights.scm
index 8f786816874..68282466497 100644
--- a/crates/languages/src/python/highlights.scm
+++ b/crates/languages/src/python/highlights.scm
@@ -56,13 +56,13 @@
(function_definition
parameters: (parameters
[
- (identifier) @function.arguments ; Simple parameters
+ (identifier) @variable.parameter; Simple parameters
(typed_parameter
- (identifier) @function.arguments) ; Typed parameters
+ (identifier) @variable.parameter) ; Typed parameters
(default_parameter
- name: (identifier) @function.arguments) ; Default parameters
+ name: (identifier) @variable.parameter) ; Default parameters
(typed_default_parameter
- name: (identifier) @function.arguments) ; Typed default parameters
+ name: (identifier) @variable.parameter) ; Typed default parameters
]))
; Keyword arguments
@@ -88,9 +88,9 @@
((call
function: (identifier) @function.builtin)
- (#match?
+ (#any-of?
@function.builtin
- "^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
+ "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__"))
((identifier) @type.builtin
(#any-of? @type.builtin "int" "float" "complex" "bool" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview" "set" "frozenset" "dict"))
@@ -117,7 +117,7 @@
[
(parameters (identifier) @variable.special)
(attribute (identifier) @variable.special)
- (#match? @variable.special "^self|cls$")
+ (#any-of? @variable.special "self" "cls")
]
[