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 highlighting: multi-line token? #982

Closed
Eskibear opened this issue May 12, 2020 · 3 comments
Closed

semantic highlighting: multi-line token? #982

Eskibear opened this issue May 12, 2020 · 3 comments
Milestone

Comments

@Eskibear
Copy link
Member

It's about Text Block in Java, see https://openjdk.java.net/jeps/355

class Foo {
  private String bar = """
    hello
    world
  """;
}

Intuitively I think it should be a token of String kind, covering """\n hello\n world\n """ across lines. But according to current design, it seems not possilbe to define multi-line tokens. I tried in vscode but not working (AFAIK for the moment only vscode implements the feature). I don't know if it's a bug of vscode, or by design.

If it's by design, I have to seperate the text block by defining several tokens for each line. I just feel a little bit unnatural about it. Any clarification to help me understand more?

@KamasamaK
Copy link
Contributor

Regarding VS Code, it is by design that a token cannot be multiline. See microsoft/vscode#86415. The current LSP spec for semantic highlighting is based on VS Code's API so that limitation was inherited.

@dbaeumer
Copy link
Member

Clients quite frequently keep token states by line so having tokens that spawn multiple lines is usually hard for them to implement. I do agree that the LSP specification shouldn't limit this in general so I will add a client capability that signals this. Forcing all clients to implement tokens across lines will make it hard for clients to implement that at all.

@dbaeumer dbaeumer added this to the 3.16 milestone May 12, 2020
@dbaeumer
Copy link
Member

dbaeumer commented Nov 4, 2020

Addressed via #1077

@dbaeumer dbaeumer closed this as completed Nov 4, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants