Auto merge of #12847 - Veykril:vscode-downgrade, r=Veykril

fix: Fix restart server duplicating language clients

Reverts 03a62c180e
vscode-languageclient@8.0.0-next.15 and beyond changed the behaviour of language clients to be automatically started if a request comes in while they are not running. Currently when we restart the server via the restart command we recreate the language client, which causes VSCode to restart the stopped server, effectively duplicating our language clients...

Reverting the commit is simpler right now, the proper fix would be to only create a language client once and then use the `restart` functionality on it instead.

Fixes https://github.com/rust-lang/rust-analyzer/issues/12836
This commit is contained in:
bors 2022-07-22 22:18:05 +00:00
commit 8272d2a18d
4 changed files with 30 additions and 3983 deletions

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
"dependencies": { "dependencies": {
"d3": "^7.6.1", "d3": "^7.6.1",
"d3-graphviz": "^4.1.1", "d3-graphviz": "^4.1.1",
"vscode-languageclient": "^8.0.1" "vscode-languageclient": "^8.0.0-next.14"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "~16.11.7", "@types/node": "~16.11.7",

View File

@ -261,10 +261,6 @@ export async function createClient(
} }
class ExperimentalFeatures implements lc.StaticFeature { class ExperimentalFeatures implements lc.StaticFeature {
getState(): lc.FeatureState {
return { kind: "static" };
}
fillClientCapabilities(capabilities: lc.ClientCapabilities): void { fillClientCapabilities(capabilities: lc.ClientCapabilities): void {
const caps: any = capabilities.experimental ?? {}; const caps: any = capabilities.experimental ?? {};
caps.snippetTextEdit = true; caps.snippetTextEdit = true;

View File

@ -42,7 +42,8 @@ export class Ctx {
const res = new Ctx(config, extCtx, client, serverPath, statusBar); const res = new Ctx(config, extCtx, client, serverPath, statusBar);
await client.start(); res.pushCleanup(client.start());
await client.onReady();
client.onNotification(ra.serverStatus, (params) => res.setServerStatus(params)); client.onNotification(ra.serverStatus, (params) => res.setServerStatus(params));
return res; return res;
} }