mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Python highlights: highlight functions with self as methods (#198)
Also highlight __init__/__new__ as constructor
This commit is contained in:
parent
58c6d2a73f
commit
969edeeced
1 changed files with 13 additions and 0 deletions
|
|
@ -48,6 +48,19 @@
|
|||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
((function_definition
|
||||
name: (identifier) @method
|
||||
parameters: (parameters
|
||||
(identifier) @self) )
|
||||
(eq? @self "self"))
|
||||
|
||||
((function_definition
|
||||
name: (identifier) @constructor
|
||||
parameters: (parameters
|
||||
(identifier) @self) )
|
||||
(eq? @self "self")
|
||||
(match? @constructor "(__new__|__init__)"))
|
||||
|
||||
(type (identifier) @type)
|
||||
(type
|
||||
(subscript
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue