Semantic Highlighting: extend beyond SemanticTokenTypes #644
-
Hello, I try to understand semantic highlighting. I managed to add a Let's forget for a moment that my goal is to make these italic, but let's assume I want to introduce the token type "reference". How would different themes handle this new token type, even? Would I have to define its highlighting as a default and they would use that as a fall back, or would they ignore this token type? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @RobertWalterU3d, as the LSP spec already says, it depends on the client capabilities. vscode (as one example of such a language client) would just ignore a custom
You're right, Langium or the language server protocol in general aren't designed to provide this information. It's always up to the client how they want to display certain tokens.
On another note, formatting in the language server context is usually reserved for code formatting. Token styling might be the better term for what you're looking for. |
Beta Was this translation helpful? Give feedback.
Hey @RobertWalterU3d,
as the LSP spec already says, it depends on the client capabilities. vscode (as one example of such a language client) would just ignore a custom
SemanticTokenTypes
entry by default. You can add custom type behavior through a theming extension though. See this stackoverflow thread.You're right, Langium or the language server protocol in general aren't designed to provide this information. It's always up to the client how they want to display certain tokens.
On another note, formatting in the…