From f05e94d0de575fd9d8a761095a3cff975cc53027 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 23 Jun 2022 14:58:43 -0700 Subject: [PATCH] Allow diagnostics to be published for hidden worktrees --- crates/project/src/project.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index dfb5e9bc80e591318437da8d66bbc6bd6b40bb0c..495b4300f5ab156def4bbd3e7232147a92d46d21 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -2644,9 +2644,6 @@ impl Project { let (worktree, relative_path) = self .find_local_worktree(&abs_path, cx) .ok_or_else(|| anyhow!("no worktree found for diagnostics"))?; - if !worktree.read(cx).is_visible() { - return Ok(()); - } let project_path = ProjectPath { worktree_id: worktree.read(cx).id(), @@ -4011,13 +4008,15 @@ impl Project { abs_path: &Path, cx: &AppContext, ) -> Option<(ModelHandle, PathBuf)> { - for tree in self.worktrees(cx) { - if let Some(relative_path) = tree - .read(cx) - .as_local() - .and_then(|t| abs_path.strip_prefix(t.abs_path()).ok()) - { - return Some((tree.clone(), relative_path.into())); + for tree in &self.worktrees { + if let Some(tree) = tree.upgrade(cx) { + if let Some(relative_path) = tree + .read(cx) + .as_local() + .and_then(|t| abs_path.strip_prefix(t.abs_path()).ok()) + { + return Some((tree.clone(), relative_path.into())); + } } } None