Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Highlighting not reloading on buffer reload #9

Closed
LiadOz opened this issue Jan 20, 2023 · 2 comments
Closed

Highlighting not reloading on buffer reload #9

LiadOz opened this issue Jan 20, 2023 · 2 comments

Comments

@LiadOz
Copy link

LiadOz commented Jan 20, 2023

This is a bug from the original repository p00f#112
This bug happens whenever a buffer is reloaded and it's content changes, this could happen by using a formatter, using git to checkout an open file, or any other actions that modifies an open file from outside of Neovim.

I have submitted 2 fixes for the issue #8 nvim-treesitter/nvim-treesitter#4187
Essentially, when the rainbow plugin reloads, it seems that the tree has not been reparsed, and so the function full update uses the previous tree to create the highlights.
The changes to treesitter are needed because the detach function is only called after the first reload. So if a buffer is reloaded more than once then there still may be invalid highlights.

For simplicity, if you want to check my branch without checking out a different treesitter branch you can add

vim.api.nvim_buf_clear_namespace(bufnr, nsid, 0, -1)

to the start of the M.attach function.

@mrjones2014
Copy link
Owner

I believe this is fixed by #8

@xiantang
Copy link

xiantang commented Mar 6, 2023

I believe this is fixed by #8

work like a charm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants