Skip to content

Set the augmentsSyntaxTokens client capability if appropriate #1101

Open
@Techatrix

Description

@Techatrix

The augmentsSyntaxTokens property is part of the SemanticTokensClientCapabilities in LSP specification and is documented like this:

Whether the client uses semantic tokens to augment existing syntax tokens. If set to true client side created syntax tokens and semantic tokens are both used for colorization. If set to false the client only uses the returned semantic tokens for colorization.

If the value is undefined then the client behavior is not specified.

This field essentially informs the server whether the client (lsp4ij/IntelliJ) already has basic syntax highlighting and uses semantic tokens to extend them. The server could then avoid emitting semantic tokens that carry no semantic meaning (e.g SemanticTokenTypes.keyword, SemanticTokenTypes.number) to let the syntax highlighting take over.

As far as I can tell, lsp4ij/IntelliJ is able to combine syntax highlighting with semantic tokens. Which means that augmentsSyntaxTokens should be set to whether syntax highlighting is available for the language the LSP is running on. I do not know how this is for IntelliJ plugins but it may not be possible to know whether syntax highlighting is available for a given language. In that case it may be viable to just assume that syntax highlighting is already available. This appears to be a common assumption across the three client that I know of which set augmentsSyntaxTokens:

To give some more context around this, I am trying to use this client capability for the ZLS language server in zigtools/zls#2350 and have been asked by @angelozerr to open an issue about this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions