diff options
| author | bors <bors@rust-lang.org> | 2023-10-04 17:31:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-04 17:31:44 +0000 |
| commit | b57658d9a9fbc3ca34c1eb13ef41ef0e5e4b49d0 (patch) | |
| tree | 9e3d1cfbff211dc5b7c55c4720a0c0eb6e2f1c16 | |
| parent | ad73597448a4d703dc7161c3f4a8a0602b1a12a0 (diff) | |
| parent | ab091b73d0117d9788549289d3cd1ac709b462dd (diff) | |
| download | rust-b57658d9a9fbc3ca34c1eb13ef41ef0e5e4b49d0.tar.gz rust-b57658d9a9fbc3ca34c1eb13ef41ef0e5e4b49d0.zip | |
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.
| -rw-r--r-- | editors/code/package.json | 13 | ||||
| -rw-r--r-- | editors/code/src/config.ts | 4 | ||||
| -rw-r--r-- | editors/code/src/ctx.ts | 6 |
3 files changed, 22 insertions, 1 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index 3ceec9edf4b..554b05c46c7 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -371,6 +371,19 @@ ], "markdownDescription": "Problem matchers to use for `rust-analyzer.run` command, eg `[\"$rustc\", \"$rust-panic\"]`." }, + "rust-analyzer.statusBar.clickAction": { + "type": "string", + "enum": [ + "stopServer", + "openLogs" + ], + "enumDescriptions": [ + "Stop Server", + "Open Logs" + ], + "default": "openLogs", + "markdownDescription": "Action to run when clicking the extension status bar item." + }, "rust-analyzer.server.path": { "type": [ "null", diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 9821aee6f92..987d936943a 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -329,6 +329,10 @@ export class Config { get showDependenciesExplorer() { return this.get<boolean>("showDependenciesExplorer"); } + + get statusBarClickAction() { + return this.get<string>("statusBar.clickAction"); + } } // the optional `cb?` parameter is meant to be used to add additional diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 904efa4d5eb..84d1ad98bd9 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -400,7 +400,11 @@ export class Ctx { statusBar.tooltip.appendText(status.message ?? "Ready"); statusBar.color = undefined; statusBar.backgroundColor = undefined; - statusBar.command = "rust-analyzer.openLogs"; + if (this.config.statusBarClickAction === "stopServer") { + statusBar.command = "rust-analyzer.stopServer"; + } else { + statusBar.command = "rust-analyzer.openLogs"; + } this.dependencies?.refresh(); break; case "warning": |
