Semantic highlighting protocol extension
kittaakos opened this issue · 4 comments
Note: The description was copied as is from microsoft/vscode-languageserver-node#368 (comment)
I have started to work on a semantic highlighting extension of the LSP.
The semantic highlighting information is pushed from the server to the client as a notification. This notification contains the lines and the ranges where the coloring has the be applied and the desired coloring details are given as TextMate scopes.
In the reference implementation of the client, I was trying to map the TextMate scopes into the appropriate theme I can use as a decoration in the TextEditor
decoration. How can one map the TextMate scopes into themes (and eventually TextEditorDecorationType
) with the current VS Code API?
Any suggestions and feedback are welcome. Thanks!
Related issues:
- Support semantic highlighting (
Microsoft/language-server-protocol
) - Proposal for (Semantic) Coloring (see #18) (
Microsoft/language-server-protocol
) - Provide an API for advanced/semantic source highlighting (
Microsoft/vscode
) - Add support for lexical syntax coloring (
Microsoft/language-server-protocol
)
The corresponding PR with the proposed changes is here: microsoft/vscode-languageserver-node#367
@kittaakos Just to make sure I understand what's going on, would you mind showing the JSON notification of a) opening a new file and b) making a change to one line? Let's just say the URI of the file is lsp:/folder/file.ts
.
A: User opens the following TypeScript file in a LSP client.
export class Sample {
protected test = 0;
}
B: User changes 0
to "value"
on the second line.
export class Sample {
protected test = "value";
}
Great idea, it's always bugged me that different editors have different syntax highlighting semantics.
This would be great!