Skip to content

Commit f280382

Browse files
committed
adding more TS queries
1 parent d55b625 commit f280382

File tree

3 files changed

+303
-0
lines changed

3 files changed

+303
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,213 @@
1+
[
2+
"import"
3+
"library"
4+
"export"
5+
"as"
6+
"show"
7+
"hide"
8+
] @keyword.import
9+
10+
[
11+
(case_builtin)
12+
"late"
13+
"required"
14+
"on"
15+
"extends"
16+
"in"
17+
"is"
18+
"new"
19+
"super"
20+
"with"
21+
] @keyword
22+
23+
[
24+
"class"
25+
"enum"
26+
"extension"
27+
] @keyword.type
28+
29+
"return" @keyword.return
30+
31+
[
32+
"deferred"
33+
"factory"
34+
"get"
35+
"implements"
36+
"interface"
37+
"library"
38+
"operator"
39+
"mixin"
40+
"part"
41+
"set"
42+
"typedef"
43+
] @keyword
44+
45+
[
46+
"async"
47+
"async*"
48+
"sync*"
49+
"await"
50+
"yield"
51+
] @keyword.coroutine
52+
53+
[
54+
(const_builtin)
55+
(final_builtin)
56+
"abstract"
57+
"covariant"
58+
"external"
59+
"static"
60+
"final"
61+
"base"
62+
"sealed"
63+
] @keyword.modifier
64+
65+
[
66+
"if"
67+
"else"
68+
"switch"
69+
"default"
70+
] @keyword.conditional
71+
72+
(conditional_expression
73+
[
74+
"?"
75+
":"
76+
] @keyword.conditional.ternary)
77+
78+
[
79+
"try"
80+
"throw"
81+
"catch"
82+
"finally"
83+
(break_statement)
84+
] @keyword.exception
85+
86+
[
87+
"do"
88+
"while"
89+
"continue"
90+
"for"
91+
] @keyword.repeat
92+
93+
(class_definition
94+
name: (identifier) @type)
95+
96+
(constructor_signature
97+
name: (identifier) @type)
98+
99+
(scoped_identifier
100+
scope: (identifier) @type)
101+
102+
(function_signature
103+
name: (identifier) @function.method)
104+
105+
(getter_signature
106+
(identifier) @function.method)
107+
108+
(setter_signature
109+
name: (identifier) @function.method)
110+
111+
(enum_declaration
112+
name: (identifier) @type)
113+
114+
(enum_constant
115+
name: (identifier) @type)
116+
117+
(void_type) @type
118+
119+
(type_identifier) @type
120+
121+
(type_alias
122+
(type_identifier) @type.definition)
123+
124+
(type_arguments
125+
[
126+
"<"
127+
">"
128+
] @punctuation.bracket)
129+
130+
(inferred_type) @keyword
131+
132+
1133
(identifier) @variable
2134
(this) @variable.builtin
3135

4136
(dotted_identifier_list) @string
5137
(string_literal) @string
6138

139+
[
140+
(hex_integer_literal)
141+
(decimal_integer_literal)
142+
(decimal_floating_point_literal)
143+
] @number
144+
145+
(symbol_literal) @string.special.symbol
146+
(string_literal) @string
147+
148+
(true) @boolean
149+
(false) @boolean
150+
151+
(null_literal) @constant.builtin
152+
7153
(comment) @comment
8154
(documentation_comment) @comment.documentation
155+
156+
(function_expression_body
157+
(identifier) @function.call)
158+
159+
[
160+
"=>"
161+
".."
162+
"??"
163+
"=="
164+
"!"
165+
"?"
166+
"&&"
167+
"%"
168+
"<"
169+
">"
170+
"="
171+
">="
172+
"<="
173+
"||"
174+
">>>="
175+
">>="
176+
"<<="
177+
"&="
178+
"|="
179+
"??="
180+
"%="
181+
"+="
182+
"-="
183+
"*="
184+
"/="
185+
"^="
186+
"~/="
187+
(shift_operator)
188+
(multiplicative_operator)
189+
(increment_operator)
190+
(is_operator)
191+
(prefix_operator)
192+
(equality_operator)
193+
(additive_operator)
194+
] @operator
195+
196+
[
197+
"("
198+
")"
199+
"["
200+
"]"
201+
"{"
202+
"}"
203+
] @punctuation.bracket
204+
205+
[
206+
";"
207+
"."
208+
","
209+
":"
210+
"?."
211+
"?"
212+
] @punctuation.delimiter
213+

data/tree-sitter/queries/rust/highlights.scm

+22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1+
(function_item (identifier) @function)
2+
(function_signature_item (identifier) @function)
13
(macro_invocation
24
macro: (identifier) @function.macro
35
"!" @function.macro)
46

7+
(identifier) @variable
8+
9+
(const_item
10+
name: (identifier) @constant)
11+
(type_identifier) @type
12+
(primitive_type) @type.builtin
13+
(field_identifier) @variable.member
14+
(shorthand_field_identifier) @variable.member
15+
(shorthand_field_initializer
16+
(identifier) @variable.member)
17+
(mod_item
18+
name: (identifier) @module)
19+
(self) @keyword.builtin
20+
21+
"_" @character.special
22+
523
(line_comment) @comment
624
(block_comment) @comment
725

26+
(boolean_literal) @boolean
27+
(integer_literal) @number
28+
(float_literal) @number.float
29+
830
(char_literal) @character
931

1032
(string_literal) @string
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
[
2+
(anchor_name)
3+
(alias_name)
4+
] @label
5+
6+
(tag) @type
7+
8+
[
9+
(yaml_directive)
10+
(tag_directive)
11+
(reserved_directive)
12+
] @keyword.directive
13+
14+
(block_mapping_pair
15+
key: (flow_node
16+
[
17+
(double_quote_scalar)
18+
(single_quote_scalar)
19+
] @property))
20+
21+
(block_mapping_pair
22+
key: (flow_node
23+
(plain_scalar
24+
(string_scalar) @property)))
25+
26+
(flow_mapping
27+
(_
28+
key: (flow_node
29+
[
30+
(double_quote_scalar)
31+
(single_quote_scalar)
32+
] @property)))
33+
34+
(flow_mapping
35+
(_
36+
key: (flow_node
37+
(plain_scalar
38+
(string_scalar) @property))))
39+
40+
[
41+
","
42+
"-"
43+
":"
44+
">"
45+
"?"
46+
"|"
47+
] @punctuation.delimiter
48+
49+
[
50+
"["
51+
"]"
52+
"{"
53+
"}"
54+
] @punctuation.bracket
55+
56+
[
57+
"*"
58+
"&"
59+
"---"
60+
"..."
61+
] @punctuation.special
62+
63+
(boolean_scalar) @boolean
64+
(null_scalar) @constant.builtin
65+
(double_quote_scalar) @string
66+
(single_quote_scalar) @string
67+
68+
((block_scalar) @string
69+
(#set! priority 99))
70+
71+
(string_scalar) @string
72+
(escape_sequence) @string.escape
73+
(integer_scalar) @number
74+
(float_scalar) @number
75+
(comment) @comment @spell
76+

0 commit comments

Comments
 (0)