diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2021-11-28 15:12:08 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-01-17 10:53:35 +0100 |
| commit | 6a61461d18039de7ebc8fd51f2b6ec0d4e562431 (patch) | |
| tree | d9fe134d95f58fafe4a3a8422483373429873ce4 | |
| parent | highlights(hack): extend queries add tests (diff) | |
| download | nvim-treesitter-6a61461d18039de7ebc8fd51f2b6ec0d4e562431.tar nvim-treesitter-6a61461d18039de7ebc8fd51f2b6ec0d4e562431.tar.gz nvim-treesitter-6a61461d18039de7ebc8fd51f2b6ec0d4e562431.tar.bz2 nvim-treesitter-6a61461d18039de7ebc8fd51f2b6ec0d4e562431.tar.lz nvim-treesitter-6a61461d18039de7ebc8fd51f2b6ec0d4e562431.tar.xz nvim-treesitter-6a61461d18039de7ebc8fd51f2b6ec0d4e562431.tar.zst nvim-treesitter-6a61461d18039de7ebc8fd51f2b6ec0d4e562431.zip | |
highlights(hack): add keywords implements
| -rw-r--r-- | queries/hack/highlights.scm | 14 | ||||
| -rw-r--r-- | tests/query/highlights/hack/attribute-type.hack | 2 | ||||
| -rw-r--r-- | tests/query/highlights/hack/generics.hack | 1 | ||||
| -rw-r--r-- | tests/query/highlights/hack/shapes.hack | 12 |
4 files changed, 25 insertions, 4 deletions
diff --git a/queries/hack/highlights.scm b/queries/hack/highlights.scm index 1bde66632..c7e481a80 100644 --- a/queries/hack/highlights.scm +++ b/queries/hack/highlights.scm @@ -21,6 +21,7 @@ "await" "type" "interface" + "implements" "class" "protected" "private" @@ -32,7 +33,7 @@ (xhp_modifier) (final_modifier) "extends" - "insteadof" + "insteadof" ] @keyword "use" @include @@ -61,12 +62,20 @@ "arraykey" "void" "nonnull" - (null) "mixed" "dynamic" "noreturn" ] @type.builtin +[ + (null) +] @constant.builtin + +[ + (true) + (false) +] @boolean + (type_specifier) @type (new_expression (_) @type) @@ -83,7 +92,6 @@ (qualified_identifier (identifier) @type .)) -(function_type_specifier) @function (attribute_modifier) @attribute [ "@required" diff --git a/tests/query/highlights/hack/attribute-type.hack b/tests/query/highlights/hack/attribute-type.hack index 9f62d19df..5ab9eaa4b 100644 --- a/tests/query/highlights/hack/attribute-type.hack +++ b/tests/query/highlights/hack/attribute-type.hack @@ -9,7 +9,7 @@ newtype T1 = ?shape( // ^ attribute type T2 = (function(T1): string); // ^ type -// ^ function (cannot capture keyword "function" as keyword.function) +// TODO: keyword.function (currently not in AST) <<A4(1), A5, A6(1,3,4)>> newtype T3 as int = int; diff --git a/tests/query/highlights/hack/generics.hack b/tests/query/highlights/hack/generics.hack index ea605420c..06eebc951 100644 --- a/tests/query/highlights/hack/generics.hack +++ b/tests/query/highlights/hack/generics.hack @@ -8,6 +8,7 @@ class Box<T> { public function __construct(T $data) { // ^ type // ^ parameter + // ^ keyword.function // ^ keyword // ^ method $this->data = $data; diff --git a/tests/query/highlights/hack/shapes.hack b/tests/query/highlights/hack/shapes.hack new file mode 100644 index 000000000..0f6ab3448 --- /dev/null +++ b/tests/query/highlights/hack/shapes.hack @@ -0,0 +1,12 @@ +class C extends Superclass implements Iface { +// ^ keyword ^ keyword + use Trait; + // < include + const type X = shape( + // <- keyword ^ type.builtin + "a" => int, + // ^ string + "b" => string, + // ^ type.builtin + ); +} |
