project_panel: Support multiple items in RemoveFromProject (#22455)

This makes the `RemoveFromProject` action to remove all marked entries
in the project panel instead of just the selected one.

Closes #22454

Release Notes:

- Improved the `RemoveFromProject` action to remove all selected items.
This commit is contained in:
Sergei Shulepov 2025-01-07 18:25:33 +01:00 committed by GitHub
parent 3d8625f25c
commit 56017022c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1995,8 +1995,8 @@ impl ProjectPanel {
}
fn remove_from_project(&mut self, _: &RemoveFromProject, cx: &mut ViewContext<Self>) {
if let Some((worktree, _)) = self.selected_sub_entry(cx) {
let worktree_id = worktree.read(cx).id();
for entry in self.effective_entries().iter() {
let worktree_id = entry.worktree_id;
self.project
.update(cx, |project, cx| project.remove_worktree(worktree_id, cx));
}