Closed jamal-ahmad closed 3 years ago
Semantic highlight only works with the latest language client (v7 betas). The latest beta added a breaking change as well, the next version will address that however.
ah! is that that case only for vscode language client or for all LSP client impls e.g. would atom work?
It depends on the client, I haven't paid attention to atom for a while so I'm honestly not sure (however I doubt it). The nice thing is that even if a given client doesn't support something, if they end up adding it in the future, then it will just automatically light up. 😄
I'm running into the same issue with the latest vscode and the latest commit of this repo on master. @david-driscoll mentioned that it only works with language client v7 beta? Where can I find this? I'm not sure I see anything called v7 on the vscode repo.
I'm currently reviving a semantic highlighting server, and I am surprised to find that it doesn't work at all anymore and the tokenize callback isn't getting called. It would be very helpful to me to have a set of known working libraries/clients so I can get back to testing my server.
Thanks!
I haven't been able to make V7 work yet either.
NPM has the V7 versions of the client but they're all beta. Look under "versions"
vscode-languageclient 7.0.0-next.12
npm i vscode-languageclient@7.0.0-next.12
Or
yarn add vscode-languageclient@7.0.0-next.12
Should get you the latest beta
I was able to get the sample server to work with semantic tokens by manually changing the dependences in vscode-testextension/packages.json to
"vscode-languageclient": "^7.0.0-next.12", "vscode-languageserver-protocol": "^3.16.0-next.10"
after that the test extension works with semantic tokens!
wait so you modified the package.json
of a a dependency
inside node_modules
?
If you're using the next.12
version of the vscode languageclient make sure you're using v0.18.2 as that has the fix to make it work for that. If you're using next.10
or lower the last version that supports that version of the spec is v0.18.1. Keep in mind the spec has been a proposal all this time and it can / will change the wind blows. This is the reason the main types are annotated with the Obsolete
attribute.
Seems like they've changed how Language clients are created as well? LanagugeClient
is no longer exported from the vscode-languageclient
(see output at the bottom). I do see CommonLanguageClient
which is kinda similar but it doesn't accept server options.
@david-driscoll can you please point me to where you're tracking the proposed beta changes?
src/extension.ts:3:10 - error TS2305: Module '"../node_modules/vscode-languageclient/lib/common/api"' has no exported member 'LanguageClient'.
3 import { LanguageClient, LanguageClientOptions, Trace } from 'vscode-languageclient';
~~~~~~~~~~~~~~
Found 1 error.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Yeah they've added support for browser and node language clients!
changing your import to import { LanguageClient, LanguageClientOptions, Trace } from 'vscode-languageclient/node';
should solve your problem.
The next version of the protocol spec is here: https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/ I also try to follow the repo that contains the vscode client/server https://github.com/Microsoft/vscode-languageserver-node
Confirmed that the semantic highlighting works with the import that @david-driscoll suggested. Thanks for the help @david-driscoll 🙂 Current versions that i'm using:
//client/package.json
"dependencies": {
"vscode-languageclient": "7.0.0-next.12"
},
"devDependencies": {
"@types/glob": "^7.1.3",
"@types/mocha": "^8.0.0",
"@types/node": "^12.11.7",
"@types/vscode": "^1.50.0",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"eslint": "^7.9.0",
"glob": "^7.1.6",
"mocha": "^8.1.3",
"typescript": "^4.0.2",
"vscode-test": "^1.4.0"
}
<ItemGroup>
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.8.0" />
<PackageReference Include="GuiLabs.Language.Xml" Version="1.2.46" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.3" />
<PackageReference Include="OmniSharp.Extensions.LanguageServer" Version="0.18.2" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
</ItemGroup>
👍🏼
Following the example language server under sample/SampleServer, i've created a sematic token provider for my lanaguage. However tokenize and other functions are never getting invoked. I'm confused about what the issue is? Am i missing some configs/settings?
I'm using:
OmniSharp.Extensions.LanguageServer
v-0.18.1
vscode-languageclient
v-^6.1.3
dotnet
v-3.1.102
Main entry point for language server:
Semantic Token Handler (BufferManager below is a very simple class to store text document contents):
On the client side i've set
"enableProposedApi": true
in thepackage.json
and the entry points look like so: