Auto merge of #13605 - Veykril:empty-ws-error, r=Veykril
fix: Fix r-a eagerly showing no discovered workspace errors
This commit is contained in:
commit
d3531e8ce6
@ -100,7 +100,7 @@ pub(crate) struct GlobalState {
|
||||
/// the user just adds comments or whitespace to Cargo.toml, we do not want
|
||||
/// to invalidate any salsa caches.
|
||||
pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
|
||||
pub(crate) fetch_workspaces_queue: OpQueue<Vec<anyhow::Result<ProjectWorkspace>>>,
|
||||
pub(crate) fetch_workspaces_queue: OpQueue<Option<Vec<anyhow::Result<ProjectWorkspace>>>>,
|
||||
pub(crate) fetch_build_data_queue:
|
||||
OpQueue<(Arc<Vec<ProjectWorkspace>>, Vec<anyhow::Result<WorkspaceBuildScripts>>)>,
|
||||
|
||||
|
@ -451,7 +451,7 @@ fn handle_task(&mut self, prime_caches_progress: &mut Vec<PrimeCachesProgress>,
|
||||
ProjectWorkspaceProgress::Begin => (Progress::Begin, None),
|
||||
ProjectWorkspaceProgress::Report(msg) => (Progress::Report, Some(msg)),
|
||||
ProjectWorkspaceProgress::End(workspaces) => {
|
||||
self.fetch_workspaces_queue.op_completed(workspaces);
|
||||
self.fetch_workspaces_queue.op_completed(Some(workspaces));
|
||||
|
||||
let old = Arc::clone(&self.workspaces);
|
||||
self.switch_workspaces("fetched workspace".to_string());
|
||||
|
@ -206,12 +206,9 @@ pub(crate) fn switch_workspaces(&mut self, cause: Cause) {
|
||||
self.show_and_log_error("failed to run build scripts".to_string(), Some(error));
|
||||
}
|
||||
|
||||
let workspaces = self
|
||||
.fetch_workspaces_queue
|
||||
.last_op_result()
|
||||
.iter()
|
||||
.filter_map(|res| res.as_ref().ok().cloned())
|
||||
.collect::<Vec<_>>();
|
||||
let Some(workspaces) = self.fetch_workspaces_queue.last_op_result() else { return; };
|
||||
let workspaces =
|
||||
workspaces.iter().filter_map(|res| res.as_ref().ok().cloned()).collect::<Vec<_>>();
|
||||
|
||||
fn eq_ignore_build_data<'a>(
|
||||
left: &'a ProjectWorkspace,
|
||||
@ -435,7 +432,7 @@ fn eq_ignore_build_data<'a>(
|
||||
fn fetch_workspace_error(&self) -> Result<(), String> {
|
||||
let mut buf = String::new();
|
||||
|
||||
let last_op_result = self.fetch_workspaces_queue.last_op_result();
|
||||
let Some(last_op_result) = self.fetch_workspaces_queue.last_op_result() else { return Ok(()) };
|
||||
if last_op_result.is_empty() {
|
||||
stdx::format_to!(buf, "rust-analyzer failed to discover workspace");
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user