debugger: Fix DebugAdapterDelegate::worktree_root always using the first visible worktree (#32585)

Closes #32577

Release Notes:

- Fixed debugger malfunctioning when using ZED_WORKTREE_ROOT env
variable in multi-worktree workspaces.
This commit is contained in:
Piotr Osiewicz 2025-06-12 01:40:41 +02:00 committed by GitHub
parent 1083c0ac53
commit 04223f304b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 15 deletions

View file

@ -285,10 +285,12 @@ pub fn task_contexts(
.worktree_for_id(*worktree_id, cx)
.map_or(false, |worktree| is_visible_directory(&worktree, cx))
})
.or(workspace
.visible_worktrees(cx)
.next()
.map(|tree| tree.read(cx).id()));
.or_else(|| {
workspace
.visible_worktrees(cx)
.next()
.map(|tree| tree.read(cx).id())
});
let active_editor = active_item.and_then(|item| item.act_as::<Editor>(cx));