-
Notifications
You must be signed in to change notification settings - Fork 457
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
Update treesitter highlight groups + remove syntax error highlights #232
Merged
dsifford
merged 2 commits into
dracula:master
from
DerekStride:tree-sitter-highlight-groups
Mar 8, 2021
Merged
Update treesitter highlight groups + remove syntax error highlights #232
dsifford
merged 2 commits into
dracula:master
from
DerekStride:tree-sitter-highlight-groups
Mar 8, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I mistakenly thought the TSError highlight group was used for highlighting error types. However upon further investigation into #231 I discovered it's actually applied to syntax errors. While typing out new code, treesitter is unable to parse the new code and will highlight with TSError, in most cases we don't want that to show up as an Error since we're not finished typing. See nvim-treesitter/nvim-treesitter#78 (comment) for more infomation.
dsifford
approved these changes
Mar 8, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks
arcticicestudio
pushed a commit
to nordtheme/vim
that referenced
this pull request
Sep 12, 2021
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
arcticicestudio
pushed a commit
to nordtheme/vim
that referenced
this pull request
Sep 12, 2021
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
I have 2 fixes for #230:
TSError
I discovered that
TSError
is used for syntax errors from treesitter. These errors are very common, since treesitter is an incremental parser, it parses changes to the file regularly, and often in the middle of typing new code. This causes the invalid syntax to get highlighted withTSError
as described in nvim-treesitter/nvim-treesitter#78 (comment). More often than not we want to ignore invalid syntax while typing, so I've removed the highlight forTSError
.I don't think this will fix the root cause of #231, however, I discovered this issue will attempting to debug it and this should provide a bandaid to the bad experience.