Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Some comments cause neovim to slow down and freeze when present with this plugin #53

Open
wrbright opened this issue Nov 10, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@wrbright
Copy link

wrbright commented Nov 10, 2023

Neovim version

0.9.4

Language affected

Lua, vim

Query

No response

Strategy

No response

Description

Text
When opening a file with less normal commenting, this plugin seems to slow the application to a crawl and eventually completely freeze Neovim.

Comments like the following effect the application.

" """"""""""""""""" "
" This is a comment "
" """"""""""""""""" "

----------
- This is another comment
----------
@wrbright wrbright added the bug Something isn't working label Nov 10, 2023
@HiPhish
Copy link
Owner

HiPhish commented Nov 11, 2023

Do you have the comment grammar installed? That parser will create a separate node for each - or " and each word inside the comment. Please try without the comment grammar first if you have it installed.

@wrbright
Copy link
Author

Thank you for you're response,

I can confirm that the issue is only present when the comment grammar is installed, and uninstalling it does fix the issue. Is this plugin incompatible with the comment grammar?

@wrbright
Copy link
Author

I can also confirm that blacklisting "comment" does fix this issue, while allowing the parser to remain installed.

For anyone looking at this later on, this is the config within lua to achieve this:

vim.g.rainbow_delimiters = {
	blacklist = {
		"comment"
	}
}

Thank you, by the way, for maintaining this project. By my understanding at least three other projects were created by others which had ultimately been archived, I appreciate your effort in keeping this alive.

@HiPhish
Copy link
Owner

HiPhish commented Nov 11, 2023

Can you please check the current master? There has been a major update and it might have fixed the problem as a side effect.

By my understanding at least three other projects were created by others which had ultimately been archived

To be honest, I can't blame them. All pre-Treesitter projects were doomed from the start, there is only so far you can get with regex hackery before the cracks start forming. p00f/nvim-ts-rainbow had potential, but the author was trying to do too much with as little code as possible. That's generally a good thing, but languages are too different that you could rule them all with one query, you get too many edge cases you have to wrestle with.

When he abandoned it I forked the project (HiPhish/nvim-ts-rainbow2) in March this year. My fork split queries and strategies out from the core. This means we have to write a completely new query for each language, but it also means fewer edge cases.

And then I forked that fork again in July of this year because of changes in nvim-treesitter. And just today I have merged a massive refactoring. It's beautiful, finally HTML tags can have proper highlighting. Highlighting delimiters is not hard in itself, but there are weird edge cases when it comes to nested languages.

Please don't misunderstand me, I'm not whining. I have wanted a plugin like this even back when I was using Vim before Neovim even existed, I just never imagined I would be the one maintaining it. I find the journey fascinating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants