diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index a8f3e4c44ff5840e5569608aba164f1a7ae76ac2..6279e1d7cf528550e31426230db458cd00ce8330 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -301,10 +301,10 @@ impl ProjectPanel { workspace::AddFolderToProject, )); if is_root { - menu_entries.push(ContextMenuItem::action( - "Remove from Project", - workspace::RemoveWorktreeFromProject(worktree_id), - )); + let project = self.project.clone(); + menu_entries.push(ContextMenuItem::handler("Remove from Project", move |cx| { + project.update(cx, |project, cx| project.remove_worktree(worktree_id, cx)); + })); } } menu_entries.push(ContextMenuItem::action("New File", NewFile)); diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 98d8b59d4d87ed44fa32e07ce84dcfe7030ca969..cc8ef5781aeaf8f734704302c5ca9416ee3cf990 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -201,14 +201,7 @@ impl Clone for Toast { pub type WorkspaceId = i64; -impl_internal_actions!( - workspace, - [ - RemoveWorktreeFromProject, - SplitWithItem, - SplitWithProjectEntry, - ] -); +impl_internal_actions!(workspace, [SplitWithItem, SplitWithProjectEntry,]); impl_actions!(workspace, [ActivatePane]); pub fn init(app_state: Arc, cx: &mut AppContext) { @@ -285,7 +278,6 @@ pub fn init(app_state: Arc, cx: &mut AppContext) { cx.add_global_action(Workspace::close_global); cx.add_async_action(Workspace::save_all); cx.add_action(Workspace::add_folder_to_project); - cx.add_action(Workspace::remove_folder_from_project); cx.add_action( |workspace: &mut Workspace, _: &Unfollow, cx: &mut ViewContext| { let pane = workspace.active_pane().clone(); @@ -1234,15 +1226,6 @@ impl Workspace { .detach_and_log_err(cx); } - fn remove_folder_from_project( - &mut self, - RemoveWorktreeFromProject(worktree_id): &RemoveWorktreeFromProject, - cx: &mut ViewContext, - ) { - self.project - .update(cx, |project, cx| project.remove_worktree(*worktree_id, cx)); - } - fn project_path_for_path( project: ModelHandle, abs_path: &Path,