Show worktree root name for symbol when there are multiple worktrees

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-02-22 18:55:38 +01:00
parent 0e4bd4b418
commit d7db3791d5
2 changed files with 43 additions and 14 deletions

View file

@ -453,6 +453,21 @@ impl Project {
.filter_map(move |worktree| worktree.upgrade(cx))
}
pub fn strong_worktrees<'a>(
&'a self,
cx: &'a AppContext,
) -> impl 'a + Iterator<Item = ModelHandle<Worktree>> {
self.worktrees.iter().filter_map(|worktree| {
worktree.upgrade(cx).and_then(|worktree| {
if worktree.read(cx).is_weak() {
None
} else {
Some(worktree)
}
})
})
}
pub fn worktree_for_id(
&self,
id: WorktreeId,