Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ language = "ReScript"

[grammars.rescript]
repository = "https://github.com/rescript-lang/tree-sitter-rescript"
commit = "64249e68649c77d3c880e335469b464674ad1cbf"
commit = "5b90cd4e4138b1231a67977303bda47eb608480a"
26 changes: 23 additions & 3 deletions languages/rescript/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
(comment) @comment
[
(line_comment)
(block_comment)
] @comment

; Identifiers
;------------
Expand All @@ -17,6 +20,14 @@
(list_pattern)
] @type

; Dict
(dict "dict" @type.builtin)
(dict_pattern "dict" @type.builtin)
(dict_entry (string) @property)
(dict_pattern_entry (string) @property)
(dict_pattern_entry (value_identifier) @variable.parameter)
(parameter (dict_pattern (dict_pattern_entry (value_identifier) @variable.parameter)))

((type_identifier) @type.builtin
(#any-of? @type.builtin
"int" "char" "string" "float" "bool" "unit"))
Expand Down Expand Up @@ -65,6 +76,8 @@
] @string


(regex) @string.special

(character) @character
(escape_sequence) @string.escape

Expand Down Expand Up @@ -215,15 +228,22 @@
"**"
"*."
"/."
"<<"
">>"
">>>"
"<="
"=="
"==="
"!"
"!="
"!=="
">="
"&&&"
"&&"
"|||"
"||"
"^^^"
"~~~"
"="
":="
"->"
Expand All @@ -235,8 +255,8 @@
] @operator

; Explicitly enclose these operators with binary_expression
; to avoid confusion with JSX tag delimiters
(binary_expression ["<" ">" "/"] @operator)
; to avoid confusion with JSX tag delimiters and extension expressions.
(binary_expression ["<" ">" "/" "%"] @operator)

[
"("
Expand Down
9 changes: 8 additions & 1 deletion languages/rescript/injections.scm
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
((comment) @injection.content (#set! injection.language "comment"))
([
(line_comment)
(block_comment)
] @injection.content (#set! injection.language "comment"))

; regex literal
(regex
(regex_pattern) @injection.content (#set! injection.language "regex"))

; %re
(extension_expression
Expand Down
5 changes: 4 additions & 1 deletion languages/rescript/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
; Comments
;---------

(comment) @comment.around
[
(line_comment)
(block_comment)
] @comment.around

; Parameters
;-----------
Expand Down
Loading