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
Don't highlight TSError in insert mode #1016
Comments
I think you can achieve this with an auto command, maybe? |
@stsewd That works, but still would prefer an option to toggle that behaviour built into the plugin. Closing for now. |
@khaveesh nvim-treesitter does not define TSError. Maybe you color theme defines it? |
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
@khaveesh what did you do? I have the same problem @theHamsta I use Tango Light in iterm2 on macOS, I wonder if this can be changed there? Looking at the nord-vim fix, it looks like this is a feature of the colour theme itself. So I'd need to turn it off somehow Edit: this comment helped 🎉 It's a bit out of date though. I added this to my vim config to turn off error highlighting:
|
@tompreston the mapping of captures is now handled by upstream nvim. Unmap the |
...which upstream Neovim deliberately doesn't do, so this is a colorscheme issue. |
Is this working, @tompreston ?
It seems it can't find ps: I tried Unmapping I also tried couple different colorschemes but I still get weird colors while in insert mode Anyway this is the error I get:
|
Is your feature request related to a problem? Please describe.
Since treesitter highlights all errors even while typing an incomplete expression, it is very irritating. Previously, it was suggested to link TSError to the Normal hlgroup, so that the errors are never highlighted.
Describe the solution you'd like
But a better solution for those who want to be informed about syntax/parsing errors in their code, would be to highlight these errors but just not in insert mode. In a nutshell, I want TSError linked to Normal when in insert mode and
Error
otherwise.Describe alternatives you've considered
Alternatives is to put up with the constant annoyance when typing or to completely silence the error highlighting. Both are IMO inferior options.
Additional context
Previous discussions on this topic that I found were: #78 & #119.
The text was updated successfully, but these errors were encountered: