Skip to content

Commit 4dd2af5

Browse files
committed
feat: support initializeStopped setting
1 parent f21a01f commit 4dd2af5

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/tools/rust-analyzer/editors/code/package.json

Lines changed: 5 additions & 0 deletions
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
},

src/tools/rust-analyzer/editors/code/src/config.ts

Lines changed: 4 additions & 0 deletions
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 {

src/tools/rust-analyzer/editors/code/src/main.ts

Lines changed: 8 additions & 1 deletion
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)