Skip to content

Commit

Permalink
highlights(hack): fix captures
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Nov 26, 2022
1 parent bedc763 commit 6725bef
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
39 changes: 24 additions & 15 deletions queries/hack/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
(braced_expression) @none

(scoped_identifier
(qualified_identifier
(qualified_identifier
(identifier) @type))

(comment) @comment
(heredoc) @comment

[
"function"
] @keyword.function
(comment)
(heredoc)
] @comment

"function" @keyword.function

[
"async"
Expand All @@ -23,20 +23,21 @@
"interface"
"implements"
"class"
"protected"
"private"
"public"
"using"
"namespace"
"attribute"
"const"
(xhp_modifier)
(final_modifier)
"extends"
"insteadof"
] @keyword

"use" @include
[
"use"
"include"
"include_once"
"require"
"require_once"
] @include

[
"new"
Expand All @@ -47,9 +48,15 @@
"as"
] @keyword.operator

"return" @keyword.return

[
"return"
] @keyword.return
(abstract_modifier)
(final_modifier)
(static_modifier)
(visibility_modifier)
(xhp_modifier)
] @type.qualifier

[
"shape"
Expand Down Expand Up @@ -92,10 +99,10 @@
(qualified_identifier
(identifier) @type .))

(attribute_modifier) @attribute
[
"@required"
"@lateinit"
(attribute_modifier)
] @attribute

[
Expand Down Expand Up @@ -262,6 +269,8 @@
[ "</" ">" ] @tag.delimiter)

[ "." ";" "::" ":" "," ] @punctuation.delimiter
(qualified_identifier
"\\" @punctuation.delimiter)

(ternary_expression
["?" ":"] @conditional)
Expand Down
6 changes: 3 additions & 3 deletions tests/query/highlights/hack/generics.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ class Box<T> {
// ^ type
// ^ type
protected T $data;
// ^ keyword
// ^ type.qualifier
// ^ type

public function __construct(T $data) {
// ^ type
// ^ parameter
// ^ keyword.function
// ^ keyword
// ^ type.qualifier
// ^ method
$this->data = $data;
}

public function getData(): T {
// ^ method
// ^ keyword
// ^ type.qualifier
return $this->data;
// ^ operator
// ^ variable.builtin
Expand Down
4 changes: 2 additions & 2 deletions tests/query/highlights/xhp-intro.hack
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use type Facebook\XHP\HTML\{XHPHTMLHelpers, a, form};


final xhp class a_post extends x\element {
// ^ keyword
// ^ keyword
// ^ type.qualifier
// ^ type.qualifier
// ^ keyword
use XHPHTMLHelpers;

Expand Down

0 comments on commit 6725bef

Please sign in to comment.