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]: Majoring stuttering in Zig files #102

Open
Bvngee opened this issue Mar 6, 2024 · 13 comments
Open

[Bug]: Majoring stuttering in Zig files #102

Bvngee opened this issue Mar 6, 2024 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@Bvngee
Copy link

Bvngee commented Mar 6, 2024

Neovim version

0.9.4

Language affected

Zig

Query

rainbow-delimiters

Strategy

No response

Description

Hey, firstly thanks for the awesome plugin!
I've been having unbearably long stutters in Zig files only. Changing the strategy from global to local only made the performance hit maybe slightly worse. I have also tried disabling/blacklisting comment as suggested in #53, to no avail. The size of the file does not seem to matter either (it happens in tiny files too), and I have been unable to replicate it in any other filetype. It's strange.. like every 1-2 seconds neovim freezes entirely for a second and then resumes. I'm happy to record a video or do some debugging if it's helpful! Thanks.

@Bvngee Bvngee added the bug Something isn't working label Mar 6, 2024
@HiPhish
Copy link
Owner

HiPhish commented Mar 6, 2024

Can you please provide a sample file where the stutter occurs? There is a test file /test/highlight/zig/regular.zig, does it happen with that file as well?

@Bvngee
Copy link
Author

Bvngee commented Mar 7, 2024

The stuttering happens even in a simple .zig file with just a main function (but I tested /test/highlight/zig/regular.zig anyways and yes it also has the stuttering). It does seem to happen worse in larger files though. Note, this is happening with no lsp running. Here's a video if it helps show the issue: https://streamable.com/2num4c

@HiPhish
Copy link
Owner

HiPhish commented Mar 7, 2024

Oh, so it only happens in insert mode? Yes, I can replicate that. I just never noticed because I never write Zig, I was just looking at the highlighting. That's an interesting problem, I am not sure how to profile the Lua code. There is :h profiling for Vim script code. Maybe I can use vim.loop.now().

@Bvngee
Copy link
Author

Bvngee commented Mar 15, 2024

Sorry for the delay! Please let me know if there's anything I can do or test on my end to help the debugging process. I'm not very familiar with the lua internals or where to go for profiling but I'd be happy to test anything you come up with!

@HiPhish
Copy link
Owner

HiPhish commented Mar 17, 2024

Sorry, I am quite busy at the moment and this issue is rather low on the list of priorities. For the time being you should blacklist Zig until I get around to debugging the issue.

@Bvngee
Copy link
Author

Bvngee commented Mar 17, 2024 via email

@jinzhongjia
Copy link

Great plugin, I use this zig-webui for testing, it will stuck a little while,

@jinzhongjia
Copy link

I'll go through the code and try to fix it

@samsvp
Copy link

samsvp commented Jul 24, 2024

I have also been experiencing this bug with zig, other languages run fine (or at least C, Lua and Rust do).
Zig/ZLS version is 0.13.0.

@HiPhish
Copy link
Owner

HiPhish commented Aug 30, 2024

There have been updates to the Zig parser and I have just pushed an updated query to master. Can everyone in this thread who was suffering from slowdowns please test with the latest versions of both this plugin and nvim-treesitter?

@Bvngee
Copy link
Author

Bvngee commented Aug 31, 2024

There have been updates to the Zig parser and I have just pushed an updated query to master. Can everyone in this thread who was suffering from slowdowns please test with the latest versions of both this plugin and nvim-treesitter?

From my very brief testing the issue seems to be completely fixed!! Thank you so much. Your effort and this awesome plugin does not go underappreciated 🙏

I'll leave the issue open for a tad bit longer just in case any more issues come up.

@HiPhish
Copy link
Owner

HiPhish commented Aug 31, 2024

Thank you for your kind words, but I did not actually do anything other than just rename the patterns to fit the updated parser. There was probably some inefficiency in the parser itself and we got the performance fix for free with the updated. I had updated the nvim-treesitter version that's used for testing and then I saw a bunch of errors in the Zig query because the pattern names had changed. So after fixing the names I got curious and tried editing the sample file, and it turned out that the stuttering was gone on its own.

(the real lesson learned here is the value of automated testing)

@Bvngee
Copy link
Author

Bvngee commented Aug 31, 2024

Thank you for your kind words, but I did not actually do anything other than just rename the patterns to fit the updated parser.

I kinda figured as much, but my point remains with regards to your effort maintaining this plugin. Either way glad it seems to be fixed :P

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

4 participants