mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 11:36:54 -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
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "cls"))
|
||||
|
||||
(integer) @number
|
||||
(float) @float
|
||||
|
|
@ -288,15 +290,5 @@
|
|||
name: (identifier) @constructor)))
|
||||
(#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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue