eclipse / lsp4e

Language Server Protocol support in Eclipse IDE
Eclipse Public License 2.0
63 stars 54 forks source link

Semantic Tokens from LSP are not recognized and not colored #821

Open jnt0r opened 1 year ago

jnt0r commented 1 year ago

Following the discussion in #274 I create this issue.

Semantic tokens received from the language server are not recognised and mapped to an appropriate colour. Therefore, the files remain black and white without any additional TextMate grammar.

By manually defining a theme that maps the LSP tokens to appropriate colours, the files will appear coloured. This should not be done by the developer of a plugin, but rather in lsp4e.

My first approach would be to map the LSP tokens to the corresponding tokens in eclipse. This way it is possible to change the colours by changing the active theme. Otherwise this would not be possible by defining static colours for a token.

Is there a list of supported token names in Eclipse? What is the minimum set of tokens that each theme needs to define? What other approaches might we discuss?

jnt0r commented 12 months ago

Are there any "default" token names in Eclipse that every theme has to implement? So we could do a mapping from LSP token names to eclipse token names? With that solution it would be possible to use the user specific theme colors of the user instead of static colors defined in plugin.

mickaelistria commented 12 months ago

My first approach would be to map the LSP tokens to the corresponding tokens in eclipse. This way it is possible to change the colours by changing the active theme. Otherwise this would not be possible by defining static colours for a token. Is there a list of supported token names in Eclipse?

I think it's the good approach. However, please keep in mind that the tokens are not defined in Eclipse, but here they would be defined in the TextMate themes. TextMate themes use relatively universal conventions for tokens, so mapping the LSP4E semantic tokens type to TextMate tokens should be sustainable enough.

Please see example themes https://github.com/eclipse/tm4e/tree/main/org.eclipse.tm4e.ui/themes to see what are the usual tokens defined in a TextMate grammar and evaluate how LSP4E SemanticTokens can be mapped there.

deanmaster commented 3 months ago

hi @mickaelistria does this means ,we support semantictoken ? I would vote for any default theme color comes with Eclipse without any adjustment. This would make sure the highlighiting keywords are working for IDEs.

rubenporras commented 3 months ago

Supporting semantic highlight when TextMate is not configured to provide colors for an editor would require a configuration option because currently LSP4E is a participant on reconciliation initiated by TexMate and I do not think we can detect that TextMate is not used so that we start our own reconciliation.

If TextMate is configured to provide colors for an editor, it provides already highlight for keywords, and LSP4E would use that highlight as well, I think that is good enough.

Or is this not working for you?