Auto merge of #12754 - Veykril:vscode-status, r=Veykril

fix: Fix VSCode status bar tooltip not showing the error messages
This commit is contained in:
bors 2022-07-13 11:29:12 +00:00
commit 90b509702e

View file

@ -77,34 +77,35 @@ export class Ctx {
setServerStatus(status: ServerStatusParams) { setServerStatus(status: ServerStatusParams) {
let icon = ""; let icon = "";
const statusBar = this.statusBar;
switch (status.health) { switch (status.health) {
case "ok": case "ok":
this.statusBar.tooltip = status.message ?? "Ready"; statusBar.tooltip = status.message ?? "Ready";
this.statusBar.command = undefined; statusBar.command = undefined;
this.statusBar.color = undefined; statusBar.color = undefined;
this.statusBar.backgroundColor = undefined; statusBar.backgroundColor = undefined;
break; break;
case "warning": case "warning":
this.statusBar.tooltip += "\nClick to reload."; statusBar.tooltip =
this.statusBar.command = "rust-analyzer.reloadWorkspace"; (status.message ? status.message + "\n" : "") + "Click to reload.";
this.statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
this.statusBar.backgroundColor = new vscode.ThemeColor( statusBar.command = "rust-analyzer.reloadWorkspace";
statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
statusBar.backgroundColor = new vscode.ThemeColor(
"statusBarItem.warningBackground" "statusBarItem.warningBackground"
); );
icon = "$(warning) "; icon = "$(warning) ";
break; break;
case "error": case "error":
this.statusBar.tooltip += "\nClick to reload."; statusBar.tooltip += "\nClick to reload.";
this.statusBar.command = "rust-analyzer.reloadWorkspace"; statusBar.command = "rust-analyzer.reloadWorkspace";
this.statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground"); statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground");
this.statusBar.backgroundColor = new vscode.ThemeColor( statusBar.backgroundColor = new vscode.ThemeColor("statusBarItem.errorBackground");
"statusBarItem.errorBackground"
);
icon = "$(error) "; icon = "$(error) ";
break; break;
} }
if (!status.quiescent) icon = "$(sync~spin) "; if (!status.quiescent) icon = "$(sync~spin) ";
this.statusBar.text = `${icon}rust-analyzer`; statusBar.text = `${icon}rust-analyzer`;
} }
pushCleanup(d: Disposable) { pushCleanup(d: Disposable) {