Skip to content

feat: Support for textDocument/semanticTokens - #392

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:testDocument_semanticTokens
Jul 1, 2024
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:testDocument_semanticTokens

Conversation

@angelozerr

@angelozerr angelozerr commented Jun 30, 2024 •

Copy link
Copy Markdown
Contributor

feat: Support for textDocument/semanticTokens

Fixes #238

@FalsePattern, @CppCXY here my current work for semantic tokens support which starts working.

  • Use only textDocument/semanticTokens/full
  • Use an implementation of RainbowVisitor. You need to enable semantic tokens (for the moment I don't know how to select by default this checkbox)

image

  • Use SemanticTokensColorsProvider API to get TextAttributesKey from tokenType, tokenModifiers:
   public @Nullable TextAttributesKey getTextAttributesKey(@NotNull String tokenType,
   @NotNull List<String> tokenModifiers,
   @NotNull PsiFile file);
  • By default uses DefaultSemanticTokensColorsProvider
  • TODO: provide an extension point to use a custom SemanticTokensColorsProvider
  • Provide a semantic tokens inspector view to understand what is colorized (I did that because I was totally lost without this inspector):
    image

Please read LSPSupport/md documentation that I'm updating (not finished) to see more information like mappings between semantic token/modifiers and the TextAttributeKey.

@angelozerr

angelozerr commented Jul 1, 2024 •

Copy link
Copy Markdown
Contributor Author

@FalsePattern @CppCXY I have tested my semantic tokens support with several language servers and the result seems good, but the support must be improved again.

As it is working, do you want me to merge this PR ASAP so you can install a nightly build and you can play with semantic tokens, so you can provide feedback?

If you are OK with this idea, I could merge it ASAP, but please consider that this support is experimental and it requires some improvements.

@CppCXY

CppCXY commented Jul 1, 2024

Copy link
Copy Markdown
Contributor

As it is working, do you want I merge this PR ASAP in order to that you can install nighly build and you play with semantic tokens to give is feedback to improve it?

I agree, I will also test this feature ASAP

@angelozerr

Copy link
Copy Markdown
Contributor Author

I agree, I will also test this feature ASAP

Ok I will try to merge it today.

@angelozerr
angelozerr force-pushed the testDocument_semanticTokens branch from 87415c2 to 1438257 Compare July 1, 2024 10:58
@angelozerr
angelozerr marked this pull request as ready for review July 1, 2024 10:58
@angelozerr
angelozerr force-pushed the testDocument_semanticTokens branch 2 times, most recently from 06f9fd2 to 40a8022 Compare July 1, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for textDocument/semanticTokens

2 participants