HiPhish / rainbow-delimiters.nvim

Rainbow delimiters for Neovim with Tree-sitter
https://gitlab.com/HiPhish/rainbow-delimiters.nvim
Apache License 2.0
467 stars 34 forks source link

[Bug]: treesitter R's parser updates breaks query #128

Closed milanglacier closed 19 hours ago

milanglacier commented 4 days ago

Neovim version

0.10

Language affected

R

Query

rainbow-delimiter

Strategy

global

Description

5373c90c55a33408604d17713edaa9560306b83di in nvim-treesitter updated the R parser and makes the query in rainbow-delimiters incompatible.

I did some fix in the query by replacing the keyword name with the latest parser ( and it seems that the switch keyword is completely removed), attached is the diff, but this is still not a fully resolve, there are still some bugs which are out of my capability to solve, as I am not that familiar with treesitter query.


diff --git a/queries/r/rainbow-delimiters.scm b/queries/r/rainbow-delimiters.scm
index f76b3ac..680cc2f 100644
--- a/queries/r/rainbow-delimiters.scm
+++ b/queries/r/rainbow-delimiters.scm
@@ -10,27 +10,23 @@
   "[[" @delimiter
   "]]" @delimiter @sentinel) @container

-(if
+(if_statement
   "(" @delimiter
   ")" @delimiter @sentinel) @container

-(for
+(for_statement
   "(" @delimiter
   ")" @delimiter @sentinel) @container

-(while
-  "(" @delimiter
-  ")" @delimiter @sentinel) @container
-
-(switch
+(while_statement
   "(" @delimiter
   ")" @delimiter @sentinel) @container

 (function_definition
-  (formal_parameters
+  (parameters
     "(" @delimiter
     ")" @delimiter @sentinel)) @container

-(brace_list
+(braced_expression
   "{" @delimiter
   "}" @delimiter @sentinel) @container

However, I still get the following error when trying to opening a markdown file with R code block:

Error in decoration provider treesitter/highlighter.win:
Error executing lua: ...m/0.10.0/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 2:3. Impossible pattern:

which suggests that the rainbow-delimiters.query at line 2 col 3 does not work: Understanding why this does not work is beyond my knowledge, sorry for that.

(call
  "(" @delimiter
  ")" @delimiter @sentinel) @container
milanglacier commented 4 days ago

126 is working on this issue.

milanglacier commented 19 hours ago

Closes as #126 merged.