Skip to content

Add support for the new semantic tokens protocol #1482

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

Closed
matklad opened this issue Mar 6, 2020 · 10 comments
Closed

Add support for the new semantic tokens protocol #1482

matklad opened this issue Mar 6, 2020 · 10 comments

Comments

@matklad
Copy link
Contributor

matklad commented Mar 6, 2020

Just a heads up that LSP is currently adding a new API for semantic highlighting:

https://github.com/microsoft/vscode-languageserver-node/blob/master/protocol/src/protocol.semanticTokens.proposed.ts

Note this API is significantly different from the one currently implemented in lsp-mode. The new API is proposed by Microsoft team, and subjectively have higher chance of being stabilized. It might be a good idea to try it while it is in the proposed phase, to make sure it works OK for emacs.

At the moment, rust-analyzer and, I think TypeScript are servers that supports these API.

@matklad
Copy link
Contributor Author

matklad commented Mar 6, 2020

Also see microsoft/vscode-languageserver-node#576 for currently unresolved synchronization issues.

@yyoncho
Copy link
Member

yyoncho commented Mar 6, 2020

Thank you @matklad!

@sebastiansturm do you know if clangd is planning to implement that spec? I guess you will be interested in implementing that once clangd follows up?

@sebastiansturm
Copy link
Contributor

I'll have to check if clangd support is planned or already underway, but if this new protocol is already supported by the TypeScript server I can use that for testing. I'll have to take a look at the proposal, but judging by the description of SemanticTokensRangeParams.range, tokens can now be requested for specific regions instead of being fed to the client at the server's leisure, which seems a lot more convenient to me

@tschuett
Copy link
Contributor

clangd: https://reviews.llvm.org/D76663

@sebastiansturm
Copy link
Contributor

nice, that's even better than using TypeScript for testing. Will rebuild clangd from trunk some time the next few days and have a go at it

@tschuett
Copy link
Contributor

tschuett commented Apr 1, 2020

clangd: https://reviews.llvm.org/D77225

@sebastiansturm
Copy link
Contributor

I pushed some preliminary semanticTokens support to my fork of lsp-mode, will use this over the coming week, then add modifiers, maybe semanticTokenEdits support and minor stuff such as missing docstrings.

@sebastiansturm
Copy link
Contributor

tried this with a trunk build of clangd

@yyoncho
Copy link
Member

yyoncho commented May 24, 2020

@sebastiansturm do you have an update on that? I think this is about to be released in 3.16.

@sebastiansturm
Copy link
Contributor

I have to admit I haven't followed up on my own todo list, though I've been using my fork as a daily driver with no issues for about a month now (using trunk builds of clangd). Will prepare a PR this evening

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