This commit is contained in:
Antonio Scandurra 2022-01-20 15:26:10 +01:00
parent 66734e11af
commit a53c87edfe

View file

@ -676,28 +676,22 @@ impl Project {
.uri .uri
.to_file_path() .to_file_path()
.map_err(|_| anyhow!("URI is not a file"))?; .map_err(|_| anyhow!("URI is not a file"))?;
for tree in &self.worktrees { let (worktree, relative_path) = self
let relative_path = tree.update(cx, |tree, _| { .find_worktree_for_abs_path(&path, cx)
path.strip_prefix(tree.as_local()?.abs_path()).ok() .ok_or_else(|| anyhow!("no worktree found for diagnostics"))?;
}); let project_path = ProjectPath {
if let Some(relative_path) = relative_path { worktree_id: worktree.read(cx).id(),
let worktree_id = tree.read(cx).id(); path: relative_path.into(),
let project_path = ProjectPath { };
worktree_id, worktree.update(cx, |worktree, cx| {
path: relative_path.into(), worktree.as_local_mut().unwrap().update_diagnostics(
}; project_path.path.clone(),
tree.update(cx, |tree, cx| { diagnostics,
tree.as_local_mut().unwrap().update_diagnostics( disk_based_sources,
project_path.path.clone(), cx,
diagnostics, )
disk_based_sources, })?;
cx, cx.emit(Event::DiagnosticsUpdated(project_path));
)
})?;
cx.emit(Event::DiagnosticsUpdated(project_path));
break;
}
}
Ok(()) Ok(())
} }