Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Recursive tab/pane closing on folder deletion (#15222)
Knoqxabc712014ab7
diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rsindex 0461db4bf72..5485acb0083 100644--- a/crates/worktree/src/worktree.rs+++ b/crates/worktree/src/worktree.rs@@ -743,10 +743,31 @@ impl Worktree {Worktree::Local(this) => this.delete_entry(entry_id, trash, cx),Worktree::Remote(this) => this.delete_entry(entry_id, trash, cx),}?;- cx.emit(Event::DeletedEntry(entry_id));++ let entry = match self {+ Worktree::Local(ref this) => this.entry_for_id(entry_id),+ Worktree::Remote(ref this) => this.entry_for_id(entry_id),+ }?;++ let mut ids = vec![entry_id];+ let path = &*entry.path;++ self.get_children_ids_recursive(path, &mut ids);++ for id in ids {+ cx.emit(Event::DeletedEntry(id));+ }Some(task)}+ fn get_children_ids_recursive(&self, path: &Path, ids: &mut Vec<ProjectEntryId>) {+ let children_iter = self.child_entries(path);+ for child in children_iter {+ ids.push(child.id);+ self.get_children_ids_recursive(&child.path, ids);+ }+ }+pub fn rename_entry(&mut self,entry_id: ProjectEntryId,