Open laeubi opened 9 months ago
Sounds like a good idea to me. However, from the API point of view, I would rather suggest adding the following methods to the SemanticTokensLegend
:
int encodeTokenType(String tokenType)
int encodeTokenModifiers(Set<String> tokenModifiers)
String decodeTokenType(int tokenType)
Set<String> decodeTokenModifiers(int tokenModifiers)
@laeubi Would you like to submit a PR for that?
I'm currently try to use getting some basic syntax highlights with
SemanticTokensLegend
/org.eclipse.lsp4j.services.TextDocumentService.semanticTokensFull(SemanticTokensParams)
due to the specification this requires a non trivial transformation of types/modifiers/locations into a stream of ints.To ease implementation (and add validation) I think it would be usefull to have a method in
SemanticTokensLegend
that helps in encoding things for example returning anIntStream
and taking the keyword, the modifier and a location as input.This method can the for example fail if invalid token types are send and so on.