mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
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.
This commit is contained in:
parent
af9a658864
commit
f498184cbb
1 changed files with 6 additions and 12 deletions
|
@ -743,18 +743,12 @@ impl GlobalState {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
||||||
if !self.discover_workspace_queue.op_in_progress() {
|
if last_op_result.is_empty() && self.config.discover_workspace_config().is_none() {
|
||||||
if last_op_result.is_empty() {
|
stdx::format_to!(buf, "rust-analyzer failed to fetch workspace");
|
||||||
stdx::format_to!(buf, "rust-analyzer failed to discover workspace");
|
|
||||||
} else {
|
} else {
|
||||||
for ws in last_op_result {
|
for ws in last_op_result {
|
||||||
if let Err(err) = ws {
|
if let Err(err) = ws {
|
||||||
stdx::format_to!(
|
stdx::format_to!(buf, "rust-analyzer failed to load workspace: {:#}\n", err);
|
||||||
buf,
|
|
||||||
"rust-analyzer failed to load workspace: {:#}\n",
|
|
||||||
err
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue