Skip to content

Commit a547bae

Browse files
committed
Auto merge of rust-lang#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.
2 parents 2904b35 + 933b507 commit a547bae

File tree

1 file changed

+6
-12
lines changed
  • src/tools/rust-analyzer/crates/rust-analyzer/src

1 file changed

+6
-12
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -743,18 +743,12 @@ impl GlobalState {
743743
return Ok(());
744744
};
745745

746-
if !self.discover_workspace_queue.op_in_progress() {
747-
if last_op_result.is_empty() {
748-
stdx::format_to!(buf, "rust-analyzer failed to discover workspace");
749-
} else {
750-
for ws in last_op_result {
751-
if let Err(err) = ws {
752-
stdx::format_to!(
753-
buf,
754-
"rust-analyzer failed to load workspace: {:#}\n",
755-
err
756-
);
757-
}
746+
if last_op_result.is_empty() && self.config.discover_workspace_config().is_none() {
747+
stdx::format_to!(buf, "rust-analyzer failed to fetch workspace");
748+
} else {
749+
for ws in last_op_result {
750+
if let Err(err) = ws {
751+
stdx::format_to!(buf, "rust-analyzer failed to load workspace: {:#}\n", err);
758752
}
759753
}
760754
}

0 commit comments

Comments
 (0)