Skip to content

Commit

Permalink
Auto merge of #18359 - Daanoz:support-initializeStopped, r=Veykril
Browse files Browse the repository at this point in the history
feat: support initializeStopped setting

See #18356

Add option to start rust-analyzer in "stopped" state when the extension activates.
  • Loading branch information
bors committed Oct 21, 2024
2 parents 0d6202d + 4dd2af5 commit 87f4dad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/tools/rust-analyzer/editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/tools/rust-analyzer/editors/code/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion src/tools/rust-analyzer/editors/code/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 87f4dad

Please sign in to comment.