From 928ea2e8fbb89531925f803d7d91e7856ffdfba7 Mon Sep 17 00:00:00 2001 From: Daan Sieben Date: Mon, 21 Oct 2024 10:58:54 +0200 Subject: [PATCH] feat: support initializeStopped setting --- editors/code/package.json | 5 +++++ editors/code/src/config.ts | 4 ++++ editors/code/src/main.ts | 9 ++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/editors/code/package.json b/editors/code/package.json index 6c7f402dc5f9..8005527d2fa1 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -349,6 +349,11 @@ "markdownDescription": "Whether to show the test explorer.", "default": false, "type": "boolean" + }, + "rust-analyzer.initializeStopped": { + "markdownDescription": "Do not start rust-analyzer server when the extension is activated.", + "default": false, + "type": "boolean" } } }, diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index abb4099f9f5e..67bc72f1e126 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -330,6 +330,10 @@ export class Config { get statusBarClickAction() { return this.get("statusBar.clickAction"); } + + get initializeStopped() { + return this.get("initializeStopped"); + } } export function prepareVSCodeConfig(resp: T): T { diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 0ddc5619e994..fdf43f66f949 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -107,7 +107,14 @@ async function activateServer(ctx: Ctx): Promise { initializeDebugSessionTrackingAndRebuild(ctx); } - await ctx.start(); + if (ctx.config.initializeStopped) { + ctx.setServerStatus({ + health: "stopped", + }); + } else { + await ctx.start(); + } + return ctx; }