aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-04-23 10:52:01 -0700
committerChristian Clason <c.clason@uni-graz.at>2024-04-25 12:04:50 +0200
commit28a914eb573d6d374d57a5705faba355c1ec4d99 (patch)
tree6fe47ab581b500a15e167ff0dcf7ed5de2b7acaa
parentfeat(asm): update queries from upstream (#6505) (diff)
downloadnvim-treesitter-28a914eb573d6d374d57a5705faba355c1ec4d99.tar
nvim-treesitter-28a914eb573d6d374d57a5705faba355c1ec4d99.tar.gz
nvim-treesitter-28a914eb573d6d374d57a5705faba355c1ec4d99.tar.bz2
nvim-treesitter-28a914eb573d6d374d57a5705faba355c1ec4d99.tar.lz
nvim-treesitter-28a914eb573d6d374d57a5705faba355c1ec4d99.tar.xz
nvim-treesitter-28a914eb573d6d374d57a5705faba355c1ec4d99.tar.zst
nvim-treesitter-28a914eb573d6d374d57a5705faba355c1ec4d99.zip
fix(php): parameter and operator touch-ups
-rw-r--r--queries/php_only/highlights.scm14
-rw-r--r--tests/query/highlights/php/types.php2
-rw-r--r--tests/query/highlights/php/variables.php2
3 files changed, 11 insertions, 7 deletions
diff --git a/queries/php_only/highlights.scm b/queries/php_only/highlights.scm
index e97b49a91..3d88567e6 100644
--- a/queries/php_only/highlights.scm
+++ b/queries/php_only/highlights.scm
@@ -317,10 +317,12 @@
])
; Parameters
-[
- (simple_parameter)
- (variadic_parameter)
-] @variable.parameter
+(variadic_parameter
+ "..." @operator
+ name: (variable_name) @variable.parameter)
+
+(simple_parameter
+ name: (variable_name) @variable.parameter)
(argument
(name) @variable.parameter)
@@ -362,7 +364,9 @@
(attribute_list) @attribute
; Conditions ( ? : )
-(conditional_expression) @keyword.conditional
+(conditional_expression
+ "?" @keyword.conditional.ternary
+ ":" @keyword.conditional.ternary)
; Directives
(declare_directive
diff --git a/tests/query/highlights/php/types.php b/tests/query/highlights/php/types.php
index 5985d6361..67a1c2f43 100644
--- a/tests/query/highlights/php/types.php
+++ b/tests/query/highlights/php/types.php
@@ -2,7 +2,7 @@
function b(int $a, string $b): Foo\Dog {}
// ^^^ @type.builtin
-// ^^ @variable
+// ^^ @variable.parameter
// ^^^^^^ @type.builtin
// ^^^ @module
// ^^^ @type
diff --git a/tests/query/highlights/php/variables.php b/tests/query/highlights/php/variables.php
index a9c099ff2..f6477e131 100644
--- a/tests/query/highlights/php/variables.php
+++ b/tests/query/highlights/php/variables.php
@@ -2,7 +2,7 @@
class A {
public function foo(self $a): self {
-// ^ @variable
+// ^ @variable.parameter
new self();
// ^^^^ @constructor
new static();