diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index f939111e5d..a201c6cf36 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -419,48 +419,54 @@ impl ProjectPanel { }) }, |menu| { - menu.when(is_local, |menu| { - menu.action( - "Add Folder to Project", - Box::new(workspace::AddFolderToProject), - ) - .when(is_root, |menu| { - menu.entry( - "Remove from Project", - None, - cx.handler_for(&this, move |this, cx| { - this.project.update(cx, |project, cx| { - project.remove_worktree(worktree_id, cx) - }); - }), - ) - .action("Collapse All", Box::new(CollapseAllEntries)) + menu.action("New File", Box::new(NewFile)) + .action("New Folder", Box::new(NewDirectory)) + .separator() + .action("Reveal in Finder", Box::new(RevealInFinder)) + .when(is_dir, |menu| { + menu.action("Open in Terminal…", Box::new(OpenInTerminal)) }) - }) - .action("New File", Box::new(NewFile)) - .action("New Folder", Box::new(NewDirectory)) - .separator() - .action("Cut", Box::new(Cut)) - .action("Copy", Box::new(Copy)) - .when_some(self.clipboard_entry, |menu, entry| { - menu.when(entry.worktree_id() == worktree_id, |menu| { - menu.action("Paste", Box::new(Paste)) + .when(is_dir, |menu| { + menu.separator() + .action("Find in Folder…", Box::new(NewSearchInDirectory)) + }) + .separator() + .action("Cut", Box::new(Cut)) + .action("Copy", Box::new(Copy)) + // TODO: Paste should always be visible, but disabled when clipboard is empty + .when_some(self.clipboard_entry, |menu, entry| { + menu.when(entry.worktree_id() == worktree_id, |menu| { + menu.action("Paste", Box::new(Paste)) + }) + }) + .separator() + .action("Copy Path", Box::new(CopyPath)) + .action("Copy Relative Path", Box::new(CopyRelativePath)) + .separator() + .action("Rename", Box::new(Rename)) + .when(!is_root, |menu| { + menu.action("Delete", Box::new(Delete { skip_prompt: false })) + }) + .when(is_local & is_root, |menu| { + menu.separator() + .action( + "Add Folder to Project…", + Box::new(workspace::AddFolderToProject), + ) + .entry( + "Remove from Project", + None, + cx.handler_for(&this, move |this, cx| { + this.project.update(cx, |project, cx| { + project.remove_worktree(worktree_id, cx) + }); + }), + ) + }) + .when(is_local & is_root, |menu| { + menu.separator() + .action("Collapse All", Box::new(CollapseAllEntries)) }) - }) - .separator() - .action("Copy Path", Box::new(CopyPath)) - .action("Copy Relative Path", Box::new(CopyRelativePath)) - .separator() - .action("Reveal in Finder", Box::new(RevealInFinder)) - .when(is_dir, |menu| { - menu.action("Open in Terminal", Box::new(OpenInTerminal)) - .action("Search Inside", Box::new(NewSearchInDirectory)) - }) - .separator() - .action("Rename", Box::new(Rename)) - .when(!is_root, |menu| { - menu.action("Delete", Box::new(Delete { skip_prompt: false })) - }) }, ) });