Deprecate the 'semantic_tokens' config option in favor of 'augmentsSyntaxTokens' #2350
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.
The augmentsSyntaxTokens client capability can be used to indicate that the client is going to combine existing syntax tokens with the semantic tokens of the server. This can not only reduce the amount of data that is transferred over the protocol but can also lead to better highlighting as syntax tokens often more accurately distinguish between different language constructs on the syntax level. An example would be keywords where the LSP protocol has a single standard token type compared to syntax highlighting where different keywords are often differentiated between based on their purpose.
The
semantic_tokens
config had been added for this purpose. Thepartial
option is used to prevent LSP semantic tokens to override existing syntax highlighting of the editor. The benefit of the client capability is that this decision is automatically made by supported editors instead of relying on user to select the right configuration.The following editors should be unaffected:
partial
by defaultaugmentsSyntaxTokens
augmentsSyntaxTokens
augmentsSyntaxTokens
The following editors are affected:
Sublime Text
Requires the
semantic_highlighting
config option to be enabled.Before:


After:
The new output more closely matches the result when disabling semantic highlighting:
Neovim
Tested with tokyonight.nvim
Before:

After:

The zig.vim plugin maps the
var
,const
,comptime
andthreadlocal
keywords toFunction
which doesn't seem right. Possible fix: ziglang/zig.vim#110CoC (neovim)
Tested with tokyonight.nvim
Before:

After:

Vim defines preferred highlighting groups to share group names between many languages. The conventions that have been established by many syntax highlighting configurations are incompatible with LSP semantic highlighting and will result in poor highlighting when mixed together. Because of this,
augmentsSyntaxTokens
should be disabled in (Neo)vim when not using tree-sitter based syntax highlighting.