promql-langserver icon indicating copy to clipboard operation
promql-langserver copied to clipboard

Server side syntax highlighting

Open slrtbtfs opened this issue 5 years ago • 6 comments

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 avatar Mar 19 '20 15:03 slrtbtfs

@slrtbtfs Can you please explain this in detail?

weastel avatar Mar 19 '20 19:03 weastel

@drumilpatel2000 I guess he means there is way to do syntax highlighting with LSP

haibeey avatar Mar 19 '20 19:03 haibeey

I would like to take this up if you don't mind @drumilpatel2000 :(

haibeey avatar Mar 19 '20 19:03 haibeey

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.

slrtbtfs avatar Mar 19 '20 21:03 slrtbtfs

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

slrtbtfs avatar Apr 03 '20 10:04 slrtbtfs

Depends on https://github.com/microsoft/language-server-protocol/issues/18

slrtbtfs avatar Jun 18 '20 14:06 slrtbtfs