Allow the status bar item to be clicked again

This commit is contained in:
Lukas Wirth 2023-03-13 12:32:53 +01:00
parent 9fca0a4afe
commit cf95322541

View file

@ -289,6 +289,7 @@ export class Ctx {
statusBar.tooltip.appendText(status.message ?? "Ready"); statusBar.tooltip.appendText(status.message ?? "Ready");
statusBar.color = undefined; statusBar.color = undefined;
statusBar.backgroundColor = undefined; statusBar.backgroundColor = undefined;
statusBar.command = "rust-analyzer.stopServer";
break; break;
case "warning": case "warning":
if (status.message) { if (status.message) {
@ -298,6 +299,7 @@ export class Ctx {
statusBar.backgroundColor = new vscode.ThemeColor( statusBar.backgroundColor = new vscode.ThemeColor(
"statusBarItem.warningBackground" "statusBarItem.warningBackground"
); );
statusBar.command = "rust-analyzer.openLogs";
icon = "$(warning) "; icon = "$(warning) ";
break; break;
case "error": case "error":
@ -306,6 +308,7 @@ export class Ctx {
} }
statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground"); statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground");
statusBar.backgroundColor = new vscode.ThemeColor("statusBarItem.errorBackground"); statusBar.backgroundColor = new vscode.ThemeColor("statusBarItem.errorBackground");
statusBar.command = "rust-analyzer.openLogs";
icon = "$(error) "; icon = "$(error) ";
break; break;
case "stopped": case "stopped":
@ -315,18 +318,19 @@ export class Ctx {
); );
statusBar.color = undefined; statusBar.color = undefined;
statusBar.backgroundColor = undefined; statusBar.backgroundColor = undefined;
statusBar.command = "rust-analyzer.startServer";
statusBar.text = `$(stop-circle) rust-analyzer`; statusBar.text = `$(stop-circle) rust-analyzer`;
return; return;
} }
if (statusBar.tooltip.value) { if (statusBar.tooltip.value) {
statusBar.tooltip.appendText("\n\n"); statusBar.tooltip.appendText("\n\n");
} }
statusBar.tooltip.appendMarkdown("[Stop server](command:rust-analyzer.stopServer)");
statusBar.tooltip.appendMarkdown( statusBar.tooltip.appendMarkdown(
"\n\n[Reload Workspace](command:rust-analyzer.reloadWorkspace)" "\n\n[Reload Workspace](command:rust-analyzer.reloadWorkspace)"
); );
statusBar.tooltip.appendMarkdown("\n\n[Restart server](command:rust-analyzer.startServer)");
statusBar.tooltip.appendMarkdown("\n\n[Open logs](command:rust-analyzer.openLogs)"); statusBar.tooltip.appendMarkdown("\n\n[Open logs](command:rust-analyzer.openLogs)");
statusBar.tooltip.appendMarkdown("\n\n[Restart server](command:rust-analyzer.startServer)");
statusBar.tooltip.appendMarkdown("[Stop server](command:rust-analyzer.stopServer)");
if (!status.quiescent) icon = "$(sync~spin) "; if (!status.quiescent) icon = "$(sync~spin) ";
statusBar.text = `${icon}rust-analyzer`; statusBar.text = `${icon}rust-analyzer`;
} }