-
-
Notifications
You must be signed in to change notification settings - Fork 862
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
Highlight definition for go lags nvim on files > 50K #5389
Comments
Does the lag here means lag while editing the file, or the initial lag while opening the file? Because the latter is kindof unavoidable, while the former is fixed(somewhat) on neovim nightly: neovim/neovim#25109, neovim/neovim#25115. Can you try a more up-to-date version of neovim? Edit: I'm using nightly and it's still lagging. I honestly don't know what to do in this case 🤔 |
I am experiencing significant lag in TypeScript files while treesitter highlighting is enabled. Perhaps this is related? Opening the file is nearly instantaneous, the lag doesn't start until I try to make certain edits. Doing something like entering insert mode and backspacing an opening I'm not using nvim-treesitter-refactor, but if my issue is related to this one, the common denominator seems to be highlighting. If I I am using the latest neovim nightly and the latest versions of treesitter and parsers. I'm happy to help debug or provide more info. |
Have y'all tried uninstalling the (IDK if this is related, if it's about brackets and not //s) Can anyone upload a file that can we can do profiling on? |
Just treesitter highlighting with the files in this issue is enough to reproduce it for me. |
@lucario387 I clarified in the issue description.. It was while editing the file. Tks for pointing it out.
@b0o not sure if this is directly related as we are talking about 2 different plugins (
@lucario387 Just navigating the biggest file (1.1M) with treesitter highlight enabled and highlight definition disabled is actually fine as long as I don't try to edit the file. If I try to do any modification the lag starts.
@llllvvuu |
@llllvvuu uninstalling |
I'm also having this issue with lua files with a large number of comments (anything more than ~300 lines of comments).
Funny thing is, I spent around 2 hours trying to make a minimal config to replicate this but I'm not able to. But doing I also tried reinstalling parsers. |
@jamestrew This is going to be fixed in neovim/neovim#25201 (which currently has a typo "integer" should be "number"). The effect you're seeing is the opposite of what was hypothesized, i.e. what's happening is that you don't have the comment parser installed and Neovim keeps trying to search your filesystem for it. |
Assuming the root cause is that the whole file is being passed to the Treesitter The solution is to pass only the contents visible on the screen to the function instead, this can cause some incorrectness in the highlights, but surprisingly the errors are negligible, if not inexistent most of the time. With this approach, the performance remains the same regardless of the size of the file, the only factor is the terminal size. |
Shouldn't this issue be reported at |
Describe the bug
I work on the Argo CD project which is mainly Go development. I noticed an increasing lag (moving the cursor around the file) depending on the file size for a long time and decided to narrow down the plugin causing the issue. It turns out that the issue is caused by
nvim-treesitter-refactor
if configured with highlight-definitions. I ran a small benchmark on the project files and came up with the following:To Reproduce
Clone argocd repo:
git clone https://github.com/argoproj/argo-cd.git
Configure Neovim with
nvim-treesitter
andnvim-treesitter-refactor
and enable highlight-definitions for Go syntax.Open Neovim with Go files bigger than 50K
Expected behavior
I would be great if highlight-definitions could run in a non-blocking (nvim ui) fashion. I found some past discussion about this but it seems that running it async wasn't implemented in that occasion. However I am not sure if async in that discussion would result in a non-blocking experience.
Output of
:checkhealth nvim-treesitter
The text was updated successfully, but these errors were encountered: