feat: support initializeStopped setting

This commit is contained in:
Daan Sieben 2024-10-21 10:58:54 +02:00
parent 9323b53858
commit 928ea2e8fb
No known key found for this signature in database
GPG key ID: B040670CE44DE316
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;
} }