mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 17:30:08 -04:00
highlights(hack): add keywords implements
This commit is contained in:
parent
cc0bdabe5f
commit
6a61461d18
4 changed files with 25 additions and 4 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
"await"
|
"await"
|
||||||
"type"
|
"type"
|
||||||
"interface"
|
"interface"
|
||||||
|
"implements"
|
||||||
"class"
|
"class"
|
||||||
"protected"
|
"protected"
|
||||||
"private"
|
"private"
|
||||||
|
|
@ -32,7 +33,7 @@
|
||||||
(xhp_modifier)
|
(xhp_modifier)
|
||||||
(final_modifier)
|
(final_modifier)
|
||||||
"extends"
|
"extends"
|
||||||
"insteadof"
|
"insteadof"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
"use" @include
|
"use" @include
|
||||||
|
|
@ -61,12 +62,20 @@
|
||||||
"arraykey"
|
"arraykey"
|
||||||
"void"
|
"void"
|
||||||
"nonnull"
|
"nonnull"
|
||||||
(null)
|
|
||||||
"mixed"
|
"mixed"
|
||||||
"dynamic"
|
"dynamic"
|
||||||
"noreturn"
|
"noreturn"
|
||||||
] @type.builtin
|
] @type.builtin
|
||||||
|
|
||||||
|
[
|
||||||
|
(null)
|
||||||
|
] @constant.builtin
|
||||||
|
|
||||||
|
[
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
] @boolean
|
||||||
|
|
||||||
(type_specifier) @type
|
(type_specifier) @type
|
||||||
(new_expression
|
(new_expression
|
||||||
(_) @type)
|
(_) @type)
|
||||||
|
|
@ -83,7 +92,6 @@
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @type .))
|
(identifier) @type .))
|
||||||
|
|
||||||
(function_type_specifier) @function
|
|
||||||
(attribute_modifier) @attribute
|
(attribute_modifier) @attribute
|
||||||
[
|
[
|
||||||
"@required"
|
"@required"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ newtype T1 = ?shape(
|
||||||
// ^ attribute
|
// ^ attribute
|
||||||
type T2 = (function(T1): string);
|
type T2 = (function(T1): string);
|
||||||
// ^ type
|
// ^ type
|
||||||
// ^ function (cannot capture keyword "function" as keyword.function)
|
// TODO: keyword.function (currently not in AST)
|
||||||
|
|
||||||
<<A4(1), A5, A6(1,3,4)>>
|
<<A4(1), A5, A6(1,3,4)>>
|
||||||
newtype T3 as int = int;
|
newtype T3 as int = int;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ class Box<T> {
|
||||||
public function __construct(T $data) {
|
public function __construct(T $data) {
|
||||||
// ^ type
|
// ^ type
|
||||||
// ^ parameter
|
// ^ parameter
|
||||||
|
// ^ keyword.function
|
||||||
// ^ keyword
|
// ^ keyword
|
||||||
// ^ method
|
// ^ method
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
|
|
||||||
12
tests/query/highlights/hack/shapes.hack
Normal file
12
tests/query/highlights/hack/shapes.hack
Normal file
|
|
@ -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
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue