Skip to content

Commit

Permalink
Adapt to new tree-sitter last match wins
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilios1995 committed Mar 25, 2024
1 parent 27e6f60 commit b5bbe2f
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions queries/rescript/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@
(record_pattern
(value_identifier) @variable.member)

; highlight the right-hand side of a pipe operator as a function call
; this goes in this section to satisfy both the tree-sitter-cli and neovim.
; see comment below about `raise`
(pipe_expression
_
[(value_identifier_path
_
(value_identifier) @function.call)
(value_identifier) @function.call]
(#set! "priority" 105))

(value_identifier_path
(module_identifier)
(value_identifier) @variable.member)
Expand Down Expand Up @@ -115,16 +104,6 @@

; function calls

; neovim and tree-sitter-cli handle conflicts differently:
; in tree-sitter-cli the first match wins, while in neovim the last match does.
; to get the desired result for `raise` in both, we put it before the general function call
; queries (for the CLI), but also add a priority metadata rule (for neovim).

(call_expression
function: (value_identifier) @keyword.exception
(#set! "priority" 105)
(#eq? @keyword.exception "raise"))

(call_expression
function: (value_identifier_path
_
Expand Down Expand Up @@ -206,6 +185,9 @@
"catch"
] @keyword.exception

(call_expression
function: (value_identifier) @keyword.exception
(#eq? @keyword.exception "raise"))

[
"for"
Expand Down

0 comments on commit b5bbe2f

Please sign in to comment.