diff --git a/crates/file_finder/src/new_path_prompt.rs b/crates/file_finder/src/new_path_prompt.rs index d4492857b4..6a1b08e205 100644 --- a/crates/file_finder/src/new_path_prompt.rs +++ b/crates/file_finder/src/new_path_prompt.rs @@ -71,8 +71,16 @@ impl Match { fn project_path(&self, project: &Project, cx: &WindowContext) -> Option { let worktree_id = if let Some(path_match) = &self.path_match { WorktreeId::from_usize(path_match.worktree_id) + } else if let Some(worktree) = project.visible_worktrees(cx).find(|worktree| { + worktree + .read(cx) + .root_entry() + .is_some_and(|entry| entry.is_dir()) + }) { + worktree.read(cx).id() } else { - project.worktrees(cx).next()?.read(cx).id() + // todo(): we should find_or_create a workspace. + return None; }; let path = PathBuf::from(self.relative_path());