-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Cannot highlight parentheses in real-time #2
Comments
Seems related to another bug I reported on: lukas-reineke/indent-blankline.nvim#555 Blankline gets scope information from treesitter, but it's like it's working off of stale cached info and the scope returned is messed up once an edit is made. ":edit" also fixes things there as well. However Blankline is also fixed with ":update", but that doesn't seem to have effect for rainbow-delimiters. It seems like something to do with cache invalidation or re-scanning to sync the treesitter state is not working as expected for external plugins using treesitter that were not an issue with the depreciated treesitter modules. |
A bug in treesitter: HiPhish/rainbow-delimiters.nvim#2 makes it annoying at the moment. Will revert this later.
The same thing is happening for me. In both Racket and Clojure when using nvim-surround, parenthesis don't update color until another delimiter type is modified, such as another parenthesis. It is not limited to the Lisp language family, and happens with all other delimiters (tags included). |
It this still a problem on the current |
This problem is still present, but only with |
Do you have Tree-sitter highlighting enabled? Call For the technical background, there is a callback registered which will re-apply rainbow highlighting whenever the tree structure changes. However, this callback is only called if general Tree-sitter highlighting is enabled for that buffer. And yes, it has to be enabled per buffer. I was not aware of this because by nvim-treesitter configuration does it implicitly. |
I think the issue has been resolved on the latest plugin version, since I didn't encounter it in quite a while. At least for me. |
This issue has not been resolved!!! I have the exact same issue: the highlighting does not update in real time. It starts working as intended and updates in real time when I call I am on Hope this can be fixed!! |
Yeah, it hasn't been resolved. I noticed that it can be triggered by visual selecting a region with brackets and deleting and then undoing the deletion. |
For anyone looking for a temporary 'fix' for this problem, the following autocommand seems to work: -- HACK: temporary fix to ensure rainbow delimiters are highlighted in real-time
vim.api.nvim_create_autocmd(
"BufRead",
{
desc = "Ensure treesitter is initialized???",
callback = function()
-- if this fails then it means no parser is available for current buffer
if pcall(vim.treesitter.start) then
vim.treesitter.start()
end
end,
}
) |
To everyone who is wondering why nothing has happened: I still cannot replicate the problem, so I cannot "fix" it either. That's why this issue is still lingering on. @TheTrueWhiteOwl I don't understand this autocommand. You call |
@HiPhish I am really embarrassed about the fact that I published the code like that publicly and I must apologize for the confusion... You see, I wrote that temporary fix at something like 1:00 AM in the morning. The only important part of that autocmd was the At the time I also decided to try running other pieces of code inside buffers parsed with treesitter and since the pcall already served as a kind of way to check if I was inside such a buffer I just used it in an if statement. However later I removed those extra function calls and when I saw that the if statement was empty I just put the I feel like an absolute fool especially due to the confusion I caused... Here is the autocmd without the duplicate call. -- HACK: temporary fix to ensure rainbow delimiters are highlighted in real-time
vim.api.nvim_create_autocmd(
"BufRead",
{
desc = "Ensure treesitter is initialized???",
callback = function()
-- if this fails then it means no parser is available for current buffer
pcall(vim.treesitter.start)
end,
}
) On another note, I think it is important to also consider the possibility that this issue does not stem from the rainbow-delimiters extension, but rather from nvim-treesitter itself, since the issue is fixed by calling |
@TheTrueWhiteOwl Haha, it's OK, no need to aplogize this hard. If the problem is indeed the lack of |
It's been fixed for me (IDK when I use kakoune now) but I just felt like contributing at some point an update fixed it for my neovim. |
I checked like exactly right now. ^ |
Neovim version
0.9.1
Language affected
scheme
Query
No response
Strategy
No response
Description
The text was updated successfully, but these errors were encountered: