on 376c19e help sign in
helix/runtime/queries/rescript/highlights.scm
220 lines 3.3 kB history raw
1(comment) @comment
3; Identifiers
4;------------
6; Escaped identifiers like \"+."
7((value_identifier) @function.macro
8 (#match? @function.macro "^\\.*$"))
11 (type_identifier)
12 (unit_type)
13] @type
15(list ["list{" "}"] @type)
16(list_pattern ["list{" "}"] @type)
19 (variant_identifier)
20 (polyvar_identifier)
21] @constructor
23(record_type_field (property_identifier) @type)
24(object_type (field (property_identifier) @type))
25(record_field (property_identifier) @variable.other.member)
26(object (field (property_identifier) @variable.other.member))
27(member_expression (property_identifier) @variable.other.member)
28(module_identifier) @namespace
30; Parameters
31;----------------
33(list_pattern (value_identifier) @variable.parameter)
34(spread_pattern (value_identifier) @variable.parameter)
36; String literals
37;----------------
40 (string)
41 (template_string)
42] @string
44(template_substitution
45 "${" @punctuation.bracket
46 "}" @punctuation.bracket) @embedded
48(character) @string.special
49(escape_sequence) @string.special
51; Other literals
52;---------------
55 (true)
56 (false)
57] @constant.builtin
59(number) @constant.numeric
60(polyvar) @constant
61(polyvar_string) @constant
63; Functions
64;----------
66; parameter(s) in parens
68 (parameter (value_identifier))
69 (labeled_parameter (value_identifier))
70] @variable.parameter
72; single parameter with no parens
73(function parameter: (value_identifier) @variable.parameter)
75; Meta
76;-----
79 "@"
80 "@@"
81 (decorator_identifier)
82] @keyword.directive
84(extension_identifier) @keyword
85("%") @keyword
87; Misc
88;-----
90; (subscript_expression index: (string) @attribute)
91(polyvar_type_pattern "#" @constant)
94 ("include")
95 ("open")
96] @keyword.control.import
99 "as"
100 "export"
101 "external"
102 "let"
103 "module"
104 "private"
105 "rec"
106 "type"
107 "and"
108 "assert"
109 "async"
110 "await"
111 "with"
112 "unpack"
113] @keyword.storage.type
115"mutable" @keyword.storage.modifier
118 "if"
119 "else"
120 "switch"
121 "when"
122] @keyword.control.conditional
125 "exception"
126 "try"
127 "catch"
128] @keyword.control.exception
130(call_expression
131 function: (value_identifier) @keyword.control.exception
132 (#eq? @keyword.control.exception "raise"))
135 "for"
136 "in"
137 "to"
138 "downto"
139 "while"
140] @keyword.control.conditional
143 "."
144 ","
145 "|"
146] @punctuation.delimiter
149 "++"
150 "+"
151 "+."
152 "-"
153 "-."
154 "*"
155 "**"
156 "*."
157 "/."
158 "<="
159 "=="
160 "==="
161 "!"
162 "!="
163 "!=="
164 ">="
165 "&&"
166 "||"
167 "="
168 ":="
169 "->"
170 "|>"
171 ":>"
172 (uncurry)
173] @operator
175; Explicitly enclose these operators with binary_expression
176; to avoid confusion with JSX tag delimiters
177(binary_expression ["<" ">" "/"] @operator)
180 "("
181 ")"
182 "{"
183 "}"
184 "["
185 "]"
186] @punctuation.bracket
188(polyvar_type
189 [
190 "["
191 "[>"
192 "[<"
193 "]"
194 ] @punctuation.bracket)
197 "~"
198 "?"
199 "=>"
200 ".."
201 "..."
202] @punctuation.special
204(ternary_expression ["?" ":"] @operator)
206; JSX
207;----------
208(jsx_identifier) @tag
209(jsx_element
210 open_tag: (jsx_opening_element ["<" ">"] @punctuation.special))
211(jsx_element
212 close_tag: (jsx_closing_element ["<" "/" ">"] @punctuation.special))
213(jsx_self_closing_element ["/" ">" "<"] @punctuation.special)
214(jsx_fragment [">" "<" "/"] @punctuation.special)
215(jsx_attribute (property_identifier) @attribute)
217; Error
218;----------
220(ERROR) @keyword.control.exception