stsewd / tree-sitter-comment

Tree-sitter grammar for comment tags like TODO, FIXME(user).
https://stsewd.dev/tree-sitter-comment/
MIT License
126 stars 8 forks source link

Major performance issues with this parser enabled while editing Lua code #32

Open no-more-secrets opened 9 months ago

no-more-secrets commented 9 months ago

Hi there, I just had to disable this plugin as it is creating major performance issues in my editor at least when editing certain file types. Here is my setup:

OS: Linux; confirmed to happen on both Pop!_OS 20.04 and RedHat8, so probably not distro-dependent. Editor: Neovim v0.9.1 tree-sitter-comment version: latest

It only seems to happen though when editing Lua files. In my treesitter neovim config file I have parsers for many languages enabled, including "lua" and "comment". When I enable "comment" it makes my editor slow to a crawl, to the point where I can hardly scroll the cursor around. And it seems to get worse the longer the editing session. When I uninstall only the "comment" parser, then everything is fine.

Any idea? Sorry I can't give a reproducer, but just wanted to bring this to your attention.

stsewd commented 4 months ago

Hi, are you still able to reproduce this? There have been several improvements in Neovim to better handle injections. There is also the possibility that the parser got slow with the introduction of URLs, haven't done any tests related to that, so it's just a possibility.

no-more-secrets commented 4 months ago

@stsewd Actually for the last couple of months tree-sitter-comment doesn't seem to work for me any longer at all (i.e. my TODOs and NOTEs are no longer highlighted). I don't think I changed anything config-wise, I think it was just after an update of some kind, either nvim or plugins. Has anything recently changed with the plugin that would require a different/new configuration?

stsewd commented 4 months ago

I'm using the latest versions of both, everything works for me. Make sure you have the parser installed :TSInstall comment.

no-more-secrets commented 4 months ago

Yes I have it installed and enabled (I also tried uninstalling/reinstalling). I'm going to try doing a more thorough investigation to see if the issue is some other aspect of my config that is interfering, and come back at some point.

Would you expect tree-sitter-comment to be interfered with in any way by enabling LSP syntax highlighting? I suppose that's not the issue since I tried disabling that to no avail, but am just curious if anything LSP-related could interfere.

stsewd commented 4 months ago

Would you expect tree-sitter-comment to be interfered with in any way by enabling LSP syntax highlighting? I suppose that's not the issue since I tried disabling that to no avail, but am just curious if anything LSP-related could interfere.

I know there is a problem with one Lua's LSP that overrides highlight for comments, see https://github.com/stsewd/tree-sitter-comment/issues/22.