Auto merge of #18359 - Daanoz:support-initializeStopped, r=Veykril

feat: support initializeStopped setting

See #18356

Add option to start rust-analyzer in "stopped" state when the extension activates.
This commit is contained in:
bors 2024-10-21 14:11:33 +00:00
commit b0b5d38768
3 changed files with 17 additions and 1 deletions

View file

@ -349,6 +349,11 @@
"markdownDescription": "Whether to show the test explorer.", "markdownDescription": "Whether to show the test explorer.",
"default": false, "default": false,
"type": "boolean" "type": "boolean"
},
"rust-analyzer.initializeStopped": {
"markdownDescription": "Do not start rust-analyzer server when the extension is activated.",
"default": false,
"type": "boolean"
} }
} }
}, },

View file

@ -330,6 +330,10 @@ export class Config {
get statusBarClickAction() { get statusBarClickAction() {
return this.get<string>("statusBar.clickAction"); return this.get<string>("statusBar.clickAction");
} }
get initializeStopped() {
return this.get<boolean>("initializeStopped");
}
} }
export function prepareVSCodeConfig<T>(resp: T): T { export function prepareVSCodeConfig<T>(resp: T): T {

View file

@ -107,7 +107,14 @@ async function activateServer(ctx: Ctx): Promise<RustAnalyzerExtensionApi> {
initializeDebugSessionTrackingAndRebuild(ctx); initializeDebugSessionTrackingAndRebuild(ctx);
} }
await ctx.start(); if (ctx.config.initializeStopped) {
ctx.setServerStatus({
health: "stopped",
});
} else {
await ctx.start();
}
return ctx; return ctx;
} }