-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Aggressive error highlight with Treesitter #269
Comments
I am also experiencing this issue when using Treesitter with nvim. It looks like the |
I'll open a PR |
Hi @georg3tom and @tgturner 👋, thanks for your contributions 👍 Based on the references it looks like removing the group is currently the only solution to get rid of this, but I wonder how errors are then highlighted (if at all)? Will Neovim's LSP take over to only highlight the matched elements with the correct style (i.e. only change the foreground color of a single word) or will errors will appear the same like any other element and only messages from linters (maybe with arrow marker) will indicate that there is an error at all? I have no problem removing the group, but I would just like to understand how this affects the user experience because I don't Neovim for active development (yet) and don't have a running setup yet to test this change. |
Hey @arcticicestudio this change does not impact Neovim’s LSP error highlighting (which still works correctly) but only impacts Treesitter (Neovim’s improved syntax highlighting) error highlights. since Treesitter is constantly parsing the file, when typing you are pretty much garunteed to have invalid syntax the Treesitter can’t parse at points. It looks like most themes are not relying on Treesitter’s error groups because of this issue, but offloading the work to linters and LSP client to report syntax errors. I’m not currently at my computer but would be happy to paste an image of what LSP error highlighting looks like after the proposed change. |
Thanks @tgturner, when LSP takes care of it we can remove the group without having to worry. I'll merge #270 to get this into the next release version 0.18.0 with ETA for next Sunday (2021-09-12). |
The `TSError` group is used to highlight syntax/parser errors [1] which caused an aggressive styling where the background color of many syntax elements was rendered with `nord11` during typing. This was caused due to the fast processing of `tree-sitter` which also resulted in highlight flickering. This is a known problem and was fixed by many other themes (e.g. Dracula [2]) by removing the group again. One of the core maintainers of `nvim-treesitter` provided a solution by remapping groups [3] and also mentioned that the group is styled by the `nvim-treesitter` plugin but the active theme [4]. Syntax errors can still be highlighted through linters and parsers like Neovim's LSP [5] can still be used instead to highlight errors with the correct style (e.g. only change the foreground color of a single word). [1]: https://github.com/nvim-treesitter/nvim-treesitter/blob/fb5d6e04/doc/nvim-treesitter.txt#L493-L495 [2]: dracula/vim#232 [3]: nvim-treesitter/nvim-treesitter#78 (comment) [4]: nvim-treesitter/nvim-treesitter#1016 (comment) [5]: https://github.com/neovim/nvim-lspconfig Fixes GH-269
The `TSError` group is used to highlight syntax/parser errors [1] which caused an aggressive styling where the background color of many syntax elements was rendered with `nord11` during typing. This was caused due to the fast processing of `tree-sitter` which also resulted in highlight flickering. This is a known problem and was fixed by many other themes (e.g. Dracula [2]) by removing the group again. One of the core maintainers of `nvim-treesitter` provided a solution by remapping groups [3] and also mentioned that the group is styled by the `nvim-treesitter` plugin but the active theme [4]. Syntax errors can still be highlighted through linters and parsers like Neovim's LSP [5] can still be used instead to highlight errors with the correct style (e.g. only change the foreground color of a single word). [1]: https://github.com/nvim-treesitter/nvim-treesitter/blob/fb5d6e04/doc/nvim-treesitter.txt#L493-L495 [2]: dracula/vim#232 [3]: nvim-treesitter/nvim-treesitter#78 (comment) [4]: nvim-treesitter/nvim-treesitter#1016 (comment) [5]: https://github.com/neovim/nvim-lspconfig Fixes GH-269
Significant parts of the code bg gets highlighted in red because of syntax errors.
Occurs only when treesitter highlight is enabled
NVIM v0.5.0 with latest nvim-treesitter
The text was updated successfully, but these errors were encountered: