Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Remove `RemoveWorktreeFromProject` internal action

Antonio Scandurra6857426b7875
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index a8f3e4c44ff..6279e1d7cf5 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 98d8b59d4d8..cc8ef5781ae 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<AppState>, cx: &mut AppContext) {
@@ -285,7 +278,6 @@ pub fn init(app_state: Arc<AppState>, 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<Workspace>| {
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>,
- ) {
- self.project
- .update(cx, |project, cx| project.remove_worktree(*worktree_id, cx));
- }
-
fn project_path_for_path(
project: ModelHandle<Project>,
abs_path: &Path,