Skip to content

Commit b5bbe2f

Browse files
committed
Adapt to new tree-sitter last match wins
1 parent 27e6f60 commit b5bbe2f

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

queries/rescript/highlights.scm

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@
3838
(record_pattern
3939
(value_identifier) @variable.member)
4040

41-
; highlight the right-hand side of a pipe operator as a function call
42-
; this goes in this section to satisfy both the tree-sitter-cli and neovim.
43-
; see comment below about `raise`
44-
(pipe_expression
45-
_
46-
[(value_identifier_path
47-
_
48-
(value_identifier) @function.call)
49-
(value_identifier) @function.call]
50-
(#set! "priority" 105))
51-
5241
(value_identifier_path
5342
(module_identifier)
5443
(value_identifier) @variable.member)
@@ -115,16 +104,6 @@
115104

116105
; function calls
117106

118-
; neovim and tree-sitter-cli handle conflicts differently:
119-
; in tree-sitter-cli the first match wins, while in neovim the last match does.
120-
; to get the desired result for `raise` in both, we put it before the general function call
121-
; queries (for the CLI), but also add a priority metadata rule (for neovim).
122-
123-
(call_expression
124-
function: (value_identifier) @keyword.exception
125-
(#set! "priority" 105)
126-
(#eq? @keyword.exception "raise"))
127-
128107
(call_expression
129108
function: (value_identifier_path
130109
_
@@ -206,6 +185,9 @@
206185
"catch"
207186
] @keyword.exception
208187

188+
(call_expression
189+
function: (value_identifier) @keyword.exception
190+
(#eq? @keyword.exception "raise"))
209191

210192
[
211193
"for"

0 commit comments

Comments
 (0)