-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
How to hook up Semantic Tokens from a server ? #796
Comments
Hello there, However, I can confirm, that you do not need any additional setup on the client side. If the client starts the server and the server announces, that it has the capability to provide semantic tokens, you are fine. Regarding your final question: VSCode as a client automatically requests semantic tokens, when it needs them. So you do not need to send them on your own. In fact, there is not even a method defined in the LSP, that lets you do this. The only thing, that you can do (if I read the protocol correctly) is to send a I hope this information can help you. |
Got it, thank you very much! |
@AntoineBalaine Did you get it resolved? Any solutions for this, I got this from the [Error - 8:12:35 PM] Request textDocument/semanticTokens/full failed.
Message: Unhandled method textDocument/semanticTokens/full
Code: -32601 Here's my config very similar to yours: const result: InitializeResult = {
capabilities: {
semanticTokensProvider: {
legend: {
tokenTypes: [
'comment', 'string', 'keyword', 'number', 'regexp', 'operator', 'namespace',
'type', 'struct', 'class', 'interface', 'enum', 'typeParameter', 'function',
'method', 'decorator', 'macro', 'variable', 'parameter', 'property', 'label'
],
tokenModifiers: [
'declaration', 'documentation', 'readonly', 'static', 'abstract', 'deprecated',
'modification', 'async'
],
},
full: true,
},
.... |
I found this useful: |
@AlecGhost Hi, you said client doesn't need additional setup, however VSCode is just not sending the request to server, so client requires additional setup through vscode.languages.registerDocumentSemanticTokensProvider(selector, provider, legend); As stated in : Even though, this should not be the case, The client should send the request automatically or at least when instructed by the programmer without having to reimplement it because the LSP Client API is not understandable for someone who didn't work on it. |
@wakaztahir I have no knowledge of the VSCode internals, I can only report the behaviour I experience. My extension works without additional client-side setup for the semantic tokens, see https://github.com/AlecGhost/LSP4SPL/blob/master/editors/code/src/extension.ts. Besides, |
Hi @AlecGhost , I have fixed everything, I've mentioned everything here |
Hello,
I’m trying to hook-up the semantic tokens sample into the lsp-sample’s server.
Following the semantic highlight guide doesn’t quite give me all the info I need. The guide points to
vscode.languages.registerDocumentSemanticTokensProvider(selector, provider, legend);
, but:{semanticTokensProvider: legend}
in the server capabilities; in the server’sinitialize
, how is theDocumentSemanticTokensProvider
supposed to be hooked-up to the connection?SemanticTokens
get automatically handled at every update or must they be continuously updated in thedocumentsManager.onDidChangeContent
?Referencing
lsp-sample/server/src/server.ts
:The text was updated successfully, but these errors were encountered: