-
Notifications
You must be signed in to change notification settings - Fork 823
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
Syntax highlight #33
Comments
@vladdu document symbol is a fictive "open type in current file" in eclipse |
Thanks, but is it? The docs say "The document symbol request is sent from the client to the server to list all symbols found in a given text document." Anyway, what I am after is if there is anything about syntax highlighting. There is an issue about semantic highlighting, but I can' see anything explicit about any highlighting and 'document symbol' seemed like the thing that could provide the required information. |
well i think the semantic highlighting mentioned in the other issue is about server side highlighting in general |
Issue #18 is the only thing so far as it seems. |
I can't look at the VS Code code right now, but maybe that list gets filtered in the client (using the container field for selecting symbols at the right depth). According to the docs, the symbol information will be about all symbols in the document (including strings, numbers, booleans). |
To make my question clearer: is syntax highlighting even supposed to be supported through the protocol at all (in the current version)? |
@vladdu No syntax highlighting is intentionally not defined by LSP. Syntax highlighting is best done by the editor host (sublime, vscode, eclipse, atom) and not the server. What is on the backlog for the language server protocol is to add support for semantic coloring/classification of tokens. |
I see, thank you. I suppose it's for performance reasons, but I do highlighting in a different process and it is speedy enough. It probably requires the server on the same machine, though. |
@egamma Server-side syntax highlighting would be a really great feature, especially for research languages that change frequently. Having to recreate a language grammar in something like the TextMate format can be non-trivial, error prone, and hard to maintain. Having a single 'truth' would make it much easier (at least for me). |
@egamma Can you say a bit more about what you mean by "semantic coloring/classification of tokens"?. Is this intended to be additional highlighting and classification done after the colorization from the editor or is it something entirely separate? In other words, how is the tokenization performed? Are the token ranges computed by the server? The reason I ask is because there are some languages I would like to use this protocol for that are nearly impossible to do correct highlighting for using the usual editor approach (e.g., textmate grammars). One example is the Agda language. Due to the very flexible syntax, highlighting information needs to be computed in part during type checking and then sent to the editor. I realize this has some drawbacks but it would still be nice to be able to officially support this use case in the protocol somehow. As @smarr mentions, out-of-band highlighting like this is becoming quite common in research languages. From a technical point of view, it doesn't seem like it should be hard to support although there may be some performance issues with very large files. |
|
Is it a problem if the protocol also allows for the lexical syntax coloring to be done by the server (optionally)? It could be an extra parameter that specifies what kind of highlighting to return. |
The proposal in #124 doesn't imply that the highlighting is done based on semantic information. So I think it could be used for lexical coloring, as well. |
Is the support for syntax highlighting supposed to use the document symbols request? Wouldn't it be reasonable to be able to request this for part of a document too (in case the file is huge and scanning all of it is prohibitive)?
The text was updated successfully, but these errors were encountered: