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

Semantic Coloring #1845

Closed
dvc94ch opened this issue May 3, 2018 · 15 comments
Closed

Semantic Coloring #1845

dvc94ch opened this issue May 3, 2018 · 15 comments
Assignees
Milestone

Comments

@dvc94ch
Copy link

dvc94ch commented May 3, 2018

This would be useful for embedded dsls. Thoughts?

@svenefftinge
Copy link
Contributor

Not clear what you mean could you elaborate?

@dvc94ch
Copy link
Author

dvc94ch commented May 3, 2018

Here is an example of a dsl implemented with racket. Dsl's implemented in racket can register a color-lexer and indenter that is used by Dr. Racket - the official racket IDE. Just finished adding support for formatting and rangeFormatting to the racket langserver. Next goal is to get syntax highlighting and formatting working for arbitrary racket dsls. As you can see on the right the jsonic comment isn't highligthed even dough the langserver should know it's a comment. So I'm suggesting that there be a default tokenizer for the racket language and when the list of document symbols is returned which identifies the kind of symbol, we re-color the symbols more accurately (based on the information the registered color lexers pass to the lang-server).

screenshot from 2018-05-03 23-57-41

@gorkem
Copy link
Contributor

gorkem commented May 4, 2018

Isn't this basically semantic highlighting?

@dvc94ch
Copy link
Author

dvc94ch commented May 4, 2018

Not sure what it has to do with semantics (type checking rules and evaluation rules) but it seems that this is what people call it. So what needs to happen for semantic highlighting? Is this a duplicate of #1683?

@svenefftinge
Copy link
Contributor

Yes, that is semantic coloring. We will soon write a real proposal for that for the LSP and then implement it here and for the TS, Java, Go, Xtext language servers.

@svenefftinge svenefftinge changed the title Re-syntax-highlight based on the response from textDocument/documentSymbol Semantic Coloring May 4, 2018
@svenefftinge
Copy link
Contributor

Is this a duplicate of #1683?

No, in that ticket we discuss 'syntactic' coloring based on regexps or lexers.

@svenefftinge
Copy link
Contributor

Are you going to publish that Racket extension somewhere? Looks cool :)

@dvc94ch
Copy link
Author

dvc94ch commented May 5, 2018

Do you want to add another repo to theia-ide? It's probably not too popular out of an academic setting and may have a similar target audience as xtext, although I doubt that any company being able to afford typefox support would consider this an alternative...

@svenefftinge
Copy link
Contributor

Academic is good and choice, too. I don't know how much effort it would be to support it, but if you or someone else is willing to take care of that it would be great. It should be a separate repo (below theia-ide or not).

@dvc94ch
Copy link
Author

dvc94ch commented May 19, 2018

So what are your thoughts on the protocol?

There are a couple of implementation issues to consider:

  1. If the language server is relied on as the primary source of syntax coloring there is a considerable startup delay. This can only be solved in the client, the client should serialize the coloring state and load it when opening a file.
  2. When the semantic coloring information is only available when there are no syntax errors. Should this be handled on the client or the server? I can implement some heuristics on the server to reduce that. The current implementation sends the entire coloring state to the client on each change. The question is if the server should send updates to the client and the client tries to do the best with the information it has or the server should do most of the work to keep the client implementation simple.

@svenefftinge
Copy link
Contributor

This is best to be discussed on https://github.com/Microsoft/language-server-protocol.
I once tried to discuss something along those lines microsoft/language-server-protocol#7

@kittaakos
Copy link
Contributor

One note on the Xtext language server support (maybe it is relevant for TS, Java, and Go as well): I assume we would like to support the semantic coloring in the diff editors too. If yes, it could be tricky to get the semantic coloring information for a historical revision. Historical revisions are not part of the workspace anymore.

@kittaakos
Copy link
Contributor

There is another use-case we need to support in Theia: the preview editor. When for instance the user triggers the Find All References from the editor.

@svenefftinge svenefftinge added this to the July 2018 milestone Jun 19, 2018
@kittaakos
Copy link
Contributor

kittaakos commented Jun 20, 2018

Here are a few more related links for this task:

Edit: updated the links.

@kittaakos
Copy link
Contributor

kittaakos pushed a commit that referenced this issue Jul 10, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 10, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 11, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 11, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 11, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 18, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 26, 2018
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 27, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Jul 30, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 1, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
@svenefftinge svenefftinge modified the milestones: July 2018, August 2018 Aug 1, 2018
kittaakos pushed a commit that referenced this issue Aug 6, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 6, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 6, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 6, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 6, 2018
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 7, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 7, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 7, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Aug 8, 2018
Closes #1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
marcdumais-work pushed a commit to marcdumais-work/theia that referenced this issue Oct 15, 2018
… capabilities.

Closes eclipse-theia#1845

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants