HiPhish / nvim-ts-rainbow2

Rainbow delimiters for Neovim through Tree-sitter
https://gitlab.com/HiPhish/nvim-ts-rainbow2
Apache License 2.0
338 stars 35 forks source link

Mismatched brackets in .tex file editing (LaTeX) #31

Open hrcHarry opened 1 year ago

hrcHarry commented 1 year ago

Describe the bug NVIM v0.8.3 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

I use VimTeX to edit .tex files. In most cases, rainbow works well.

However, in some cases, the mismatched brackets occur as follows.

Imgur

Steps to reproduce For now, I'm not sure if there is any other case causing curly brackets mismatched. Presently, the following combination of commands may occur such mismatches. \footnote{... \ref{... (...) ...}} and \footnote{... \ref{... }}

Expected behavior

  1. Match the brackets correctly.
  2. Enrich the color of paired brackets like rainbow supporting C language. supporting C
HiPhish commented 1 year ago

There are a couple of issues happening:

I have just added the missing queries, so that part should work now.

The last point is simply a consequence of Tree-sitter support still being work in progress, some jank is to be expected. Usually I can deleted (dd) the offending line and put (p) it immediately back in and everything will be fine. This happens across languages.

As for the second point, take a look at this screenshot:

Screenshot_20230414_155812

According to Tree-sitter the reference extends only up to (excluding) the opening parenthesis. If you remove the parenthesized text inside the curly braces the highlighting will work properly. The plugin is doing exactly what it is supposed to do, the problem needs to be fixed either within the parser or Neovim. I don't know which of the two is causing the error.