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

Cannot highlight parentheses in real-time #52

Closed lzlcs closed 1 year ago

lzlcs commented 1 year ago

I have to restart nvim so that the paraentheses can be highlighted

HiPhish commented 1 year ago

What language? Which strategy?

lzlcs commented 1 year ago

I apologize for not providing detailed information

Ubuntu 22.04LTS (WSL2) Language: scheme Strategy: I have tried both global and local strategies Plugins Manageer: Lazy

My config:

rainbow = {
  enable = true,
  -- Which query to use for finding delimiters
  query = 'rainbow-parens',
  -- Highlight the entire buffer all at once
  strategy = require('ts-rainbow').strategy.global,
}

https://github.com/HiPhish/nvim-ts-rainbow2/assets/61308957/9bc2ed4e-1b62-4cd2-841e-4fd23421185d

HiPhish commented 1 year ago

That is very strange, it works perfectly for me with Scheme. What is your output of :set filetype?? Tree-sitter queries also use the file extension scm and Neovim might be setting the file type incorrectly. I doubt that's the problem, but we need to be certain.

Does the highlighting get applied when you execute :edit on your buffer? What happens if you add parentheses to an already highlighted section?

lzlcs commented 1 year ago
:set filetype

Output:

filetype=scheme

https://github.com/HiPhish/nvim-ts-rainbow2/assets/61308957/6b1bce6d-718c-4a1e-b3fe-8c79103959a2

HiPhish commented 1 year ago

OK, now I'm really out of ideas. Can you please try a minimal setup with only nvim-treesitter and nvim-ts-rainbow2 as the only plugins? See :h $NVIM_APPNAME for how to set up a configuration under a different name.

lzlcs commented 1 year ago

Crazy

https://github.com/HiPhish/nvim-ts-rainbow2/assets/61308957/3f7a6667-46ac-42e1-a2e2-0c9d4cf21179

HiPhish commented 1 year ago

I probably won't fix this in this repo. The nvim-treesitter plugin has deprecated the module system, so I am working on a standalone version of this plugin. It's mostly done, but since configuration is different I will make it a new plugin. The code is more or less the same and I have been able to solve some other issues along the way simply by not using the nvim-treesitter module system. I don't know if this issue will also get fixed "for free", but I don't really want to invest more time into a dying plugin.

The transition will be easy, most of the configuration can stay the same. The main difference is where and how it is applied. I will post in this thread once the new plugin is up.

lzlcs commented 1 year ago

Thank you.

HiPhish commented 1 year ago

The new rainbow plugin is here: rainbow-delimiters.nvim (GitHub mirror). Please file an issue over there if the problem still persists.