Skip to content

Commit

Permalink
Highlight query improvements for java and typescript (#7145)
Browse files Browse the repository at this point in the history
* Add missing queries to java highlights

* Fix generic type bracket highlights in typescript
  • Loading branch information
yusuphgammut committed May 26, 2023
1 parent 61a8995 commit 86ef389
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 9 deletions.
83 changes: 81 additions & 2 deletions runtime/queries/java/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
(marker_annotation
name: (identifier) @attribute)

"@" @operator

; Types

(interface_declaration
Expand Down Expand Up @@ -48,6 +46,9 @@
(void_type)
] @type.builtin

(type_arguments
(wildcard "?" @type.builtin))

; Variables

((identifier) @constant
Expand Down Expand Up @@ -87,6 +88,84 @@
(line_comment) @comment
(block_comment) @comment

; Punctuation

[
"::"
"."
";"
","
] @punctuation.delimiter

[
"@"
"..."
] @punctuation.special

[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket

(type_arguments
[
"<"
">"
] @punctuation.bracket)

(type_parameters
[
"<"
">"
] @punctuation.bracket)

; Operators

[
"="
">"
"<"
"!"
"~"
"?"
":"
"->"
"=="
">="
"<="
"!="
"&&"
"||"
"++"
"--"
"+"
"-"
"*"
"/"
"&"
"|"
"^"
"%"
"<<"
">>"
">>>"
"+="
"-="
"*="
"/="
"&="
"|="
"^="
"%="
"<<="
">>="
">>>="
] @operator

; Keywords

[
Expand Down
19 changes: 12 additions & 7 deletions runtime/queries/typescript/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

(ambient_declaration "global" @namespace)


; Variables

(required_parameter (identifier) @variable.parameter)
Expand All @@ -22,8 +21,6 @@

(conditional_type ["?" ":"] @operator)



; Keywords

[
Expand All @@ -50,16 +47,22 @@
"readonly"
] @keyword.storage.modifier

; inherits: ecma

; Types

(type_identifier) @type
(predefined_type) @type.builtin

(type_arguments
"<" @punctuation.bracket
">" @punctuation.bracket)
[
"<"
">"
] @punctuation.bracket)

(type_parameters
[
"<"
">"
] @punctuation.bracket)

((identifier) @type
(#match? @type "^[A-Z]"))
Expand All @@ -75,3 +78,5 @@
(template_type
"${" @punctuation.special
"}" @punctuation.special) @embedded

; inherits: ecma

0 comments on commit 86ef389

Please sign in to comment.