Skip to content

Commit b0b5d38

Browse files
committed
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.
2 parents 546da8a + 928ea2e commit b0b5d38

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

editors/code/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@
349349
"markdownDescription": "Whether to show the test explorer.",
350350
"default": false,
351351
"type": "boolean"
352+
},
353+
"rust-analyzer.initializeStopped": {
354+
"markdownDescription": "Do not start rust-analyzer server when the extension is activated.",
355+
"default": false,
356+
"type": "boolean"
352357
}
353358
}
354359
},

editors/code/src/config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ export class Config {
330330
get statusBarClickAction() {
331331
return this.get<string>("statusBar.clickAction");
332332
}
333+
334+
get initializeStopped() {
335+
return this.get<boolean>("initializeStopped");
336+
}
333337
}
334338

335339
export function prepareVSCodeConfig<T>(resp: T): T {

editors/code/src/main.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ async function activateServer(ctx: Ctx): Promise<RustAnalyzerExtensionApi> {
107107
initializeDebugSessionTrackingAndRebuild(ctx);
108108
}
109109

110-
await ctx.start();
110+
if (ctx.config.initializeStopped) {
111+
ctx.setServerStatus({
112+
health: "stopped",
113+
});
114+
} else {
115+
await ctx.start();
116+
}
117+
111118
return ctx;
112119
}
113120

0 commit comments

Comments
 (0)