Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side syntax highlighting #135

Open
slrtbtfs opened this issue Mar 19, 2020 · 6 comments
Open

Server side syntax highlighting #135

slrtbtfs opened this issue Mar 19, 2020 · 6 comments
Labels
enhancement New feature or request upstream Bugs that have to be fixed in a dependency

Comments

@slrtbtfs
Copy link
Member

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 slrtbtfs added the enhancement New feature or request label Mar 19, 2020
@weastel
Copy link
Contributor

weastel commented Mar 19, 2020

@slrtbtfs Can you please explain this in detail?

@haibeey
Copy link
Contributor

haibeey commented Mar 19, 2020

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

@haibeey
Copy link
Contributor

haibeey commented Mar 19, 2020

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

@slrtbtfs
Copy link
Member Author

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
Copy link
Member Author

slrtbtfs commented Apr 3, 2020

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.

microsoft/language-server-protocol#18 (comment)

@slrtbtfs
Copy link
Member Author

Depends on microsoft/language-server-protocol#18

@slrtbtfs slrtbtfs added the upstream Bugs that have to be fixed in a dependency label Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request upstream Bugs that have to be fixed in a dependency
Projects
None yet
Development

No branches or pull requests

3 participants