aboutsummaryrefslogtreecommitdiffstats
path: root/queries/python
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-07-18 19:50:45 +0200
committerThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-07-20 08:57:12 +0200
commit969edeecedca9a3875e3d34663294e69b73622c0 (patch)
tree6ab4a570d5d644bd093c6bb1af2cac0745b5c11d /queries/python
parentAttach kind of reference to query result instead of using subfields (diff)
downloadnvim-treesitter-969edeecedca9a3875e3d34663294e69b73622c0.tar
nvim-treesitter-969edeecedca9a3875e3d34663294e69b73622c0.tar.gz
nvim-treesitter-969edeecedca9a3875e3d34663294e69b73622c0.tar.bz2
nvim-treesitter-969edeecedca9a3875e3d34663294e69b73622c0.tar.lz
nvim-treesitter-969edeecedca9a3875e3d34663294e69b73622c0.tar.xz
nvim-treesitter-969edeecedca9a3875e3d34663294e69b73622c0.tar.zst
nvim-treesitter-969edeecedca9a3875e3d34663294e69b73622c0.zip
Python highlights: highlight functions with self as methods (#198)
Also highlight __init__/__new__ as constructor
Diffstat (limited to 'queries/python')
-rw-r--r--queries/python/highlights.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm
index c1e6bf1d7..52dbb6169 100644
--- a/queries/python/highlights.scm
+++ b/queries/python/highlights.scm
@@ -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