Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/rescript/highlights.scm')
-rw-r--r--runtime/queries/rescript/highlights.scm161
1 files changed, 80 insertions, 81 deletions
diff --git a/runtime/queries/rescript/highlights.scm b/runtime/queries/rescript/highlights.scm
index 8decebb4..ed41322b 100644
--- a/runtime/queries/rescript/highlights.scm
+++ b/runtime/queries/rescript/highlights.scm
@@ -1,69 +1,5 @@
(comment) @comment
-[
- "."
- ","
- "|"
-] @punctuation.delimiter
-
-[
- "++"
- "+"
- "+."
- "-"
- "-."
- "*"
- "**"
- "*."
- "/."
- "<="
- "=="
- "==="
- "!"
- "!="
- "!=="
- ">="
- "&&"
- "||"
- "="
- ":="
- "->"
- "|>"
- ":>"
- "+="
- (uncurry)
-] @operator
-
-; Explicitly enclose these operators with binary_expression
-; to avoid confusion with JSX tag delimiters
-(binary_expression ["<" ">" "/"] @operator)
-
-[
- "("
- ")"
- "{"
- "}"
- "["
- "]"
-] @punctuation.bracket
-
-(polyvar_type
- [
- "["
- "[>"
- "[<"
- "]"
- ] @punctuation.bracket)
-
-[
- "~"
- "?"
- "=>"
- ".."
- "..."
-] @punctuation.special
-
-
; Identifiers
;------------
@@ -74,10 +10,11 @@
[
(type_identifier)
(unit_type)
- (list)
- (list_pattern)
] @type
+(list ["list{" "}"] @type)
+(list_pattern ["list{" "}"] @type)
+
[
(variant_identifier)
(polyvar_identifier)
@@ -135,16 +72,14 @@
; single parameter with no parens
(function parameter: (value_identifier) @variable.parameter)
-; first-level descructuring (required for nvim-tree-sitter as it only matches direct
-; children and the above patterns do not match destructuring patterns in NeoVim)
-(parameter (tuple_pattern (tuple_item_pattern (value_identifier) @variable.parameter)))
-(parameter (array_pattern (value_identifier) @variable.parameter))
-(parameter (record_pattern (value_identifier) @variable.parameter))
-
; Meta
;-----
-(decorator_identifier) @keyword.directive
+[
+ "@"
+ "@@"
+ (decorator_identifier)
+] @keyword.directive
(extension_identifier) @keyword
("%") @keyword
@@ -152,7 +87,7 @@
; Misc
;-----
-(subscript_expression index: (string) @attribute)
+; (subscript_expression index: (string) @attribute)
(polyvar_type_pattern "#" @constant)
[
@@ -166,21 +101,18 @@
"external"
"let"
"module"
- "mutable"
"private"
"rec"
"type"
"and"
"assert"
+ "async"
"await"
"with"
- "lazy"
- "constraint"
-] @keyword
+ "unpack"
+] @keyword.storage.type
-((function "async" @keyword.storage))
-
-(module_unpack "unpack" @keyword)
+"mutable" @keyword.storage.modifier
[
"if"
@@ -207,6 +139,68 @@
"while"
] @keyword.control.conditional
+[
+ "."
+ ","
+ "|"
+] @punctuation.delimiter
+
+[
+ "++"
+ "+"
+ "+."
+ "-"
+ "-."
+ "*"
+ "**"
+ "*."
+ "/."
+ "<="
+ "=="
+ "==="
+ "!"
+ "!="
+ "!=="
+ ">="
+ "&&"
+ "||"
+ "="
+ ":="
+ "->"
+ "|>"
+ ":>"
+ (uncurry)
+] @operator
+
+; Explicitly enclose these operators with binary_expression
+; to avoid confusion with JSX tag delimiters
+(binary_expression ["<" ">" "/"] @operator)
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+(polyvar_type
+ [
+ "["
+ "[>"
+ "[<"
+ "]"
+ ] @punctuation.bracket)
+
+[
+ "~"
+ "?"
+ "=>"
+ ".."
+ "..."
+] @punctuation.special
+
(ternary_expression ["?" ":"] @operator)
; JSX
@@ -219,3 +213,8 @@
(jsx_self_closing_element ["/" ">" "<"] @punctuation.special)
(jsx_fragment [">" "<" "/"] @punctuation.special)
(jsx_attribute (property_identifier) @attribute)
+
+; Error
+;----------
+
+(ERROR) @keyword.control.exception