about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-26 18:56:08 +0000
committerbors <bors@rust-lang.org>2024-09-26 18:56:08 +0000
commita547baed6230d5f505ee4dc8ba03d1ca3cb12088 (patch)
treec799669b9604ab2b35195983160b7c341d6e16bb
parent2904b35bdf82c8f73493639e7eaf81d23dbe5c23 (diff)
parent933b50740a3e51964525c17fc2405d7721a63d69 (diff)
downloadrust-a547baed6230d5f505ee4dc8ba03d1ca3cb12088.tar.gz
rust-a547baed6230d5f505ee4dc8ba03d1ca3cb12088.zip
Auto merge of #18193 - Wilfred:startup_error, r=lnicola
fix: Don't report a startup error when a discover command is configured

Previously, r-a would show an error if both fetch_workspaces_queue and discover_workspace_queue were empty. We're in this state at startup, so users would see an error if they'd configured
discover_workspace_config.

Instead, allow the fetch_workspaces_queue to have zero items if discover_workspace_config is set.

Whilst we're here, prefer "failed to fetch" over "failed to discover", so the error message better reflects what this function is doing.
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs
index f6765715c5a..7a1782e5651 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs
@@ -743,18 +743,12 @@ impl GlobalState {
             return Ok(());
         };
 
-        if !self.discover_workspace_queue.op_in_progress() {
-            if last_op_result.is_empty() {
-                stdx::format_to!(buf, "rust-analyzer failed to discover workspace");
-            } else {
-                for ws in last_op_result {
-                    if let Err(err) = ws {
-                        stdx::format_to!(
-                            buf,
-                            "rust-analyzer failed to load workspace: {:#}\n",
-                            err
-                        );
-                    }
+        if last_op_result.is_empty() && self.config.discover_workspace_config().is_none() {
+            stdx::format_to!(buf, "rust-analyzer failed to fetch workspace");
+        } else {
+            for ws in last_op_result {
+                if let Err(err) = ws {
+                    stdx::format_to!(buf, "rust-analyzer failed to load workspace: {:#}\n", err);
                 }
             }
         }