redhat-developer / redhat-developer/lsp4ij

Set the `augmentsSyntaxTokens` client capability if appropriate

Open
#1,101 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement semantic tokens
Dominant language
Java
Stars
344
Forks
113
Avg merge
5h 22m
Merged PRs (30d)
15

Description

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 https://github.com/zigtools/zls/pull/2350 and have been asked by @angelozerr to open an issue about this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating where lsp4ij constructs SemanticTokensClientCapabilities and determine whether IntelliJ can report syntax-highlighting availability for the active language. Compare the behavior with the linked VS Code, Sublime Text, and Neovim implementations; done means the client advertises augmentsSyntaxTokens with a documented, tested policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.