diff options
| author | Caleb White <cdwhite3@pm.me> | 2025-01-02 11:27:28 -0600 |
|---|---|---|
| committer | Christian Clason <ch.clason+github@icloud.com> | 2025-01-02 19:13:44 +0100 |
| commit | 6cb4098d51479f644f967c17d4482bab1ba2640f (patch) | |
| tree | 3b10e261dc3056e4a7d001ad420dccc154f1bf02 | |
| parent | bot(lockfile): update gdscript, qmljs (diff) | |
| download | nvim-treesitter-6cb4098d51479f644f967c17d4482bab1ba2640f.tar nvim-treesitter-6cb4098d51479f644f967c17d4482bab1ba2640f.tar.gz nvim-treesitter-6cb4098d51479f644f967c17d4482bab1ba2640f.tar.bz2 nvim-treesitter-6cb4098d51479f644f967c17d4482bab1ba2640f.tar.lz nvim-treesitter-6cb4098d51479f644f967c17d4482bab1ba2640f.tar.xz nvim-treesitter-6cb4098d51479f644f967c17d4482bab1ba2640f.tar.zst nvim-treesitter-6cb4098d51479f644f967c17d4482bab1ba2640f.zip | |
fix(php): properly highlight grouped imported functions and constants
| -rw-r--r-- | queries/php_only/highlights.scm | 22 | ||||
| -rw-r--r-- | tests/query/highlights/php/keywords.php | 12 |
2 files changed, 34 insertions, 0 deletions
diff --git a/queries/php_only/highlights.scm b/queries/php_only/highlights.scm index 790bd088f..6d51154df 100644 --- a/queries/php_only/highlights.scm +++ b/queries/php_only/highlights.scm @@ -233,6 +233,17 @@ alias: (name) @function ]) +(namespace_use_declaration + type: "function" + body: (namespace_use_group + (namespace_use_clause + [ + (name) @function + (qualified_name + (name) @function) + alias: (name) @function + ]))) + (namespace_use_clause type: "const" [ @@ -242,6 +253,17 @@ alias: (name) @constant ]) +(namespace_use_declaration + type: "const" + body: (namespace_use_group + (namespace_use_clause + [ + (name) @constant + (qualified_name + (name) @constant) + alias: (name) @constant + ]))) + (class_interface_clause [ (name) @type diff --git a/tests/query/highlights/php/keywords.php b/tests/query/highlights/php/keywords.php index 6b938c43f..5504cab19 100644 --- a/tests/query/highlights/php/keywords.php +++ b/tests/query/highlights/php/keywords.php @@ -12,16 +12,28 @@ use Foo\Baz as Baaz; // ^^ @keyword.operator // ^^^^ @type.definition +use Foo\Baz\{Foo, Bar}; +// ^^^ @type +// ^^^ @type + use function Foo\foo as fooo; // ^^^^^^^^ @keyword.function // ^^^ @function // ^^^^ @function +use function Foo\{bar, baz}; +// ^^^ @function +// ^^^ @function + use const Foo\FOO as FOOO; // ^^^^^ @keyword.modifier // ^^^ @constant // ^^^^ @constant +use const Foo\{FOO, BAR}; +// ^^^ @constant +// ^^^ @constant + use Foo\Baz\{ // ^^^ @module // ^^^ @module |
