feat: support initializeStopped setting

This commit is contained in:
Daan Sieben 2024-10-21 10:58:54 +02:00
parent f21a01f5ef
commit 4dd2af5113
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.",
"default": false,
"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() {
return this.get<string>("statusBar.clickAction");
}
get initializeStopped() {
return this.get<boolean>("initializeStopped");
}
}
export function prepareVSCodeConfig<T>(resp: T): T {

View File

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