aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Härtl <haertl.mike@gmail.com>2022-01-17 21:09:18 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-01-17 21:38:40 +0100
commit723d91e8217ae66ea75f809f404d801ed939f497 (patch)
tree8abb997042992b33951090afdd3c21c848942976
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-723d91e8217ae66ea75f809f404d801ed939f497.tar
nvim-treesitter-723d91e8217ae66ea75f809f404d801ed939f497.tar.gz
nvim-treesitter-723d91e8217ae66ea75f809f404d801ed939f497.tar.bz2
nvim-treesitter-723d91e8217ae66ea75f809f404d801ed939f497.tar.lz
nvim-treesitter-723d91e8217ae66ea75f809f404d801ed939f497.tar.xz
nvim-treesitter-723d91e8217ae66ea75f809f404d801ed939f497.tar.zst
nvim-treesitter-723d91e8217ae66ea75f809f404d801ed939f497.zip
highlights(php): detect constructor calls on instantiation
-rw-r--r--queries/php/highlights.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/queries/php/highlights.scm b/queries/php/highlights.scm
index 91a08cf95..1d8f01584 100644
--- a/queries/php/highlights.scm
+++ b/queries/php/highlights.scm
@@ -28,7 +28,7 @@
. [(name) (qualified_name)] @type
(name) @constant)
-; Functions
+; Functions, methods, constructors
(array_creation_expression "array" @function.builtin)
(list_literal "list" @function.builtin)
@@ -54,6 +54,12 @@
(nullsafe_member_call_expression
name: (name) @method)
+(method_declaration
+ name: (name) @constructor
+ (#eq? @constructor "__construct"))
+(object_creation_expression
+ [(name) (qualified_name)] @constructor)
+
; Parameters
[
(simple_parameter)
@@ -78,10 +84,6 @@
((name) @constant
(#vim-match? @constant "^_?[A-Z][A-Z\d_]+$"))
-(method_declaration
- name: (name) @constructor
- (#eq? @constructor "__construct"))
-
(const_declaration (const_element (name) @constant))
((name) @variable.builtin