about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-13 11:29:12 +0000
committerbors <bors@rust-lang.org>2022-07-13 11:29:12 +0000
commit90b509702e412bb40ff230de20d1a8d6aa45e465 (patch)
tree62cb8b839f94b4b78a1f2ed18ba35ef08145037b
parentfc47ce53c8ed91dec1f791d79eb4566988266e73 (diff)
parentdef89af1eff41291df4d83e38c2ada8ad9931266 (diff)
downloadrust-90b509702e412bb40ff230de20d1a8d6aa45e465.tar.gz
rust-90b509702e412bb40ff230de20d1a8d6aa45e465.zip
Auto merge of #12754 - Veykril:vscode-status, r=Veykril
fix: Fix VSCode status bar tooltip not showing the error messages
-rw-r--r--editors/code/src/ctx.ts31
1 files changed, 16 insertions, 15 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 992c3d5de69..f2d47370105 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -77,34 +77,35 @@ export class Ctx {
 
     setServerStatus(status: ServerStatusParams) {
         let icon = "";
+        const statusBar = this.statusBar;
         switch (status.health) {
             case "ok":
-                this.statusBar.tooltip = status.message ?? "Ready";
-                this.statusBar.command = undefined;
-                this.statusBar.color = undefined;
-                this.statusBar.backgroundColor = undefined;
+                statusBar.tooltip = status.message ?? "Ready";
+                statusBar.command = undefined;
+                statusBar.color = undefined;
+                statusBar.backgroundColor = undefined;
                 break;
             case "warning":
-                this.statusBar.tooltip += "\nClick to reload.";
-                this.statusBar.command = "rust-analyzer.reloadWorkspace";
-                this.statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
-                this.statusBar.backgroundColor = new vscode.ThemeColor(
+                statusBar.tooltip =
+                    (status.message ? status.message + "\n" : "") + "Click to reload.";
+
+                statusBar.command = "rust-analyzer.reloadWorkspace";
+                statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
+                statusBar.backgroundColor = new vscode.ThemeColor(
                     "statusBarItem.warningBackground"
                 );
                 icon = "$(warning) ";
                 break;
             case "error":
-                this.statusBar.tooltip += "\nClick to reload.";
-                this.statusBar.command = "rust-analyzer.reloadWorkspace";
-                this.statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground");
-                this.statusBar.backgroundColor = new vscode.ThemeColor(
-                    "statusBarItem.errorBackground"
-                );
+                statusBar.tooltip += "\nClick to reload.";
+                statusBar.command = "rust-analyzer.reloadWorkspace";
+                statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground");
+                statusBar.backgroundColor = new vscode.ThemeColor("statusBarItem.errorBackground");
                 icon = "$(error) ";
                 break;
         }
         if (!status.quiescent) icon = "$(sync~spin) ";
-        this.statusBar.text = `${icon}rust-analyzer`;
+        statusBar.text = `${icon}rust-analyzer`;
     }
 
     pushCleanup(d: Disposable) {