Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Organize Project Panel context menus (#10456)
Nate Butler27ba16504624
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rsindex f939111e5d9..a201c6cf36f 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))+ })+ .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)+ });+ }),+ )})- })- .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_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 }))- })},)});