Skip to content

Commit 90b5097

Browse files
committed
Auto merge of rust-lang#12754 - Veykril:vscode-status, r=Veykril
fix: Fix VSCode status bar tooltip not showing the error messages
2 parents fc47ce5 + def89af commit 90b5097

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

editors/code/src/ctx.ts

+16-15
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,35 @@ export class Ctx {
7777

7878
setServerStatus(status: ServerStatusParams) {
7979
let icon = "";
80+
const statusBar = this.statusBar;
8081
switch (status.health) {
8182
case "ok":
82-
this.statusBar.tooltip = status.message ?? "Ready";
83-
this.statusBar.command = undefined;
84-
this.statusBar.color = undefined;
85-
this.statusBar.backgroundColor = undefined;
83+
statusBar.tooltip = status.message ?? "Ready";
84+
statusBar.command = undefined;
85+
statusBar.color = undefined;
86+
statusBar.backgroundColor = undefined;
8687
break;
8788
case "warning":
88-
this.statusBar.tooltip += "\nClick to reload.";
89-
this.statusBar.command = "rust-analyzer.reloadWorkspace";
90-
this.statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
91-
this.statusBar.backgroundColor = new vscode.ThemeColor(
89+
statusBar.tooltip =
90+
(status.message ? status.message + "\n" : "") + "Click to reload.";
91+
92+
statusBar.command = "rust-analyzer.reloadWorkspace";
93+
statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
94+
statusBar.backgroundColor = new vscode.ThemeColor(
9295
"statusBarItem.warningBackground"
9396
);
9497
icon = "$(warning) ";
9598
break;
9699
case "error":
97-
this.statusBar.tooltip += "\nClick to reload.";
98-
this.statusBar.command = "rust-analyzer.reloadWorkspace";
99-
this.statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground");
100-
this.statusBar.backgroundColor = new vscode.ThemeColor(
101-
"statusBarItem.errorBackground"
102-
);
100+
statusBar.tooltip += "\nClick to reload.";
101+
statusBar.command = "rust-analyzer.reloadWorkspace";
102+
statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground");
103+
statusBar.backgroundColor = new vscode.ThemeColor("statusBarItem.errorBackground");
103104
icon = "$(error) ";
104105
break;
105106
}
106107
if (!status.quiescent) icon = "$(sync~spin) ";
107-
this.statusBar.text = `${icon}rust-analyzer`;
108+
statusBar.text = `${icon}rust-analyzer`;
108109
}
109110

110111
pushCleanup(d: Disposable) {

0 commit comments

Comments
 (0)