promql-langserver
promql-langserver copied to clipboard
Server side syntax highlighting
There is a new LSP protocol extension for syntax highlighting provided by the language server.
A implementation for this would be nice to have.
@slrtbtfs Can you please explain this in detail?
@drumilpatel2000 I guess he means there is way to do syntax highlighting with LSP
I would like to take this up if you don't mind @drumilpatel2000 :(
At the moment this is more of a vague idea than a solid plan.
However, implementing this would be quite involved and would require a lot of prior research and a proposal explaining how it is planned to be done.
Things this would likely include:
- Changing the langserver cache to not only store a syntax tree but also a list of lexer tokens. This might need some changes in the PromQL parser as well for performance reasons.
- A way to combine the information provided by the lexer with the parsed syntax tree to accurately figure out what function each token serves. As a simpler, but not completely correct solution it would be possible to only consider the lexer tokens.
- A plan how to deal with YAML files and how to coordinate things with a YAML language server that might be running in parallel.
It looks like the TypeScript language server now supports syntax highlighting.
I guess this increases the chance of having semantic highlighting as a part of the next protocol version.
https://github.com/microsoft/language-server-protocol/issues/18#issuecomment-607870150
Depends on https://github.com/microsoft/language-server-protocol/issues/18