summaryrefslogtreecommitdiff
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
parent58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9 (diff)
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 c1e6bf1d..52dbb616 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