about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-22 22:18:05 +0000
committerbors <bors@rust-lang.org>2022-07-22 22:18:05 +0000
commit8272d2a18dff6de74a687884fb357490ee29450c (patch)
tree8703262f63dea70244cdaccdf73832b917318ef8 /editors/code/src
parentd469e0de9acc38b2e63796fb105369e567773cfb (diff)
parentf1b5e3856317a38db996fe3e01b119aa0f2c3144 (diff)
downloadrust-8272d2a18dff6de74a687884fb357490ee29450c.tar.gz
rust-8272d2a18dff6de74a687884fb357490ee29450c.zip
Auto merge of #12847 - Veykril:vscode-downgrade, r=Veykril
fix: Fix restart server duplicating language clients

Reverts 03a62c180e6a7300d0d7b8c4d680b749c101bcbb
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
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/client.ts4
-rw-r--r--editors/code/src/ctx.ts3
2 files changed, 2 insertions, 5 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index a8d57a0e684..8a2dea6b35b 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -261,10 +261,6 @@ export async function createClient(
 }
 
 class ExperimentalFeatures implements lc.StaticFeature {
-    getState(): lc.FeatureState {
-        return { kind: "static" };
-    }
-
     fillClientCapabilities(capabilities: lc.ClientCapabilities): void {
         const caps: any = capabilities.experimental ?? {};
         caps.snippetTextEdit = true;
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index f2d47370105..0dea1b87b2f 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -42,7 +42,8 @@ export class Ctx {
 
         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));
         return res;
     }