Skip to content

Commit b57658d

Browse files
committed
Auto merge of #15707 - dfireBird:default-statusbar-action-config, r=lnicola
Add configuration for the default action of the status bar click action in VSCode Fixes #15441 Please suggest any changes if necessary.
2 parents ad73597 + ab091b7 commit b57658d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

editors/code/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,19 @@
371371
],
372372
"markdownDescription": "Problem matchers to use for `rust-analyzer.run` command, eg `[\"$rustc\", \"$rust-panic\"]`."
373373
},
374+
"rust-analyzer.statusBar.clickAction": {
375+
"type": "string",
376+
"enum": [
377+
"stopServer",
378+
"openLogs"
379+
],
380+
"enumDescriptions": [
381+
"Stop Server",
382+
"Open Logs"
383+
],
384+
"default": "openLogs",
385+
"markdownDescription": "Action to run when clicking the extension status bar item."
386+
},
374387
"rust-analyzer.server.path": {
375388
"type": [
376389
"null",

editors/code/src/config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ export class Config {
329329
get showDependenciesExplorer() {
330330
return this.get<boolean>("showDependenciesExplorer");
331331
}
332+
333+
get statusBarClickAction() {
334+
return this.get<string>("statusBar.clickAction");
335+
}
332336
}
333337

334338
// the optional `cb?` parameter is meant to be used to add additional

editors/code/src/ctx.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,11 @@ export class Ctx {
400400
statusBar.tooltip.appendText(status.message ?? "Ready");
401401
statusBar.color = undefined;
402402
statusBar.backgroundColor = undefined;
403-
statusBar.command = "rust-analyzer.openLogs";
403+
if (this.config.statusBarClickAction === "stopServer") {
404+
statusBar.command = "rust-analyzer.stopServer";
405+
} else {
406+
statusBar.command = "rust-analyzer.openLogs";
407+
}
404408
this.dependencies?.refresh();
405409
break;
406410
case "warning":

0 commit comments

Comments
 (0)