From 969edeecedca9a3875e3d34663294e69b73622c0 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 18 Jul 2020 19:50:45 +0200 Subject: Python highlights: highlight functions with self as methods (#198) Also highlight __init__/__new__ as constructor --- queries/python/highlights.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'queries/python') 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 -- cgit v1.2.3-70-g09d2