mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
fix: keep cls variable highlighting consistent in class methods
This commit is contained in:
parent
dc23e86e47
commit
e6ff4c8084
1 changed files with 2 additions and 10 deletions
|
|
@ -134,6 +134,8 @@
|
||||||
[(true) (false)] @boolean
|
[(true) (false)] @boolean
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#eq? @variable.builtin "self"))
|
(#eq? @variable.builtin "self"))
|
||||||
|
((identifier) @variable.builtin
|
||||||
|
(#eq? @variable.builtin "cls"))
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
(float) @float
|
(float) @float
|
||||||
|
|
@ -288,15 +290,5 @@
|
||||||
name: (identifier) @constructor)))
|
name: (identifier) @constructor)))
|
||||||
(#any-of? @constructor "__new__" "__init__"))
|
(#any-of? @constructor "__new__" "__init__"))
|
||||||
|
|
||||||
; First parameter of a classmethod is cls.
|
|
||||||
((class_definition
|
|
||||||
body: (block
|
|
||||||
(decorated_definition
|
|
||||||
(decorator (identifier) @_decorator)
|
|
||||||
definition: (function_definition
|
|
||||||
parameters: (parameters . (identifier) @variable.builtin)))))
|
|
||||||
(#eq? @variable.builtin "cls")
|
|
||||||
(#eq? @_decorator "classmethod"))
|
|
||||||
|
|
||||||
;; Error
|
;; Error
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue