# Objective Add remote (SSH) and collaboration support for trashing and restoring files in the project panel, which in turn enables undo/redo of trash operations against remote and collab projects. Relates to #5039. ## Solution - Updated the project panel undo system to carry `TrashId` instead of `TrashedEntry`. - Using `TrashedEntry` could get hairy, as it includes paths, which wouldn't play too nicely when using, for exapmle, macOS as the client and Windows as the host. Using a simple identifier is much easier in this regard and simplifies implementation. - Enabled the Trash action and context-menu entry on remote projects, and removed the command palette filter in `ProjectPanel::new` that was still hiding the action on remote. - As far as I can tell, there isn't a reliable way to detect whether a given remote actually supports the OS trash, so we expose the action everywhere rather than guessing. On a remote without trash support the action will fail when invoked but this is a conscious tradeoff until we find a better way to handle this. - `fs` now tracks trashed files in a `SlotMap<TrashId, TrashedEntry>` on each `Fs` implementation. Trashed files are referenced by an opaque `TrashId` instead of passing a `TrashedEntry` around, which avoids serializing filesystem paths in remote messages. - Split the old `delete_entry(trash: bool)` API into distinct `trash_entry`/`trash_file` (returning a `TrashId`) and `delete_entry`/`delete_file` across `Project`, `Worktree`, `LocalWorktree` and `RemoteWorktree`. - This lets us drop the optional trash result (`Option<TrashedEntry>`) from the delete path and require a `TrashId` from the trash path. - Added new proto messages (`TrashProjectEntry`, `TrashProjectEntryResponse`, `RestoreProjectEntry`, `RestoreProjectEntryResponse`) to let clients request the host to trash or restore entries. - This deprecates `DeleteProjectEntry::use_trash`, but the host still honors it. An older collab peer may request trashing via that flag instead of the newer `TrashProjectEntry`. If the host ignored it, a newer host would permanently delete a file the user meant to send to the trash. The field will be removed in a later PR once all supported peers use `TrashProjectEntry`. ## Testing The following tests were introduced to ensure the new behavior is correctly tested: * `remote_server::remote_editing_tests::test_remote_trash_restore` – Tests trashing a project entry in remote * `remote_server::remote_editing_tests::test_remote_delete_project_entry_with_trash` – Test to ensure we continue respecting `DeleteProjectEntry::use_trash` until it is fully removed * `project_panel::tests::undo::trash_directory_undo_redo` – Not related to these changes but a nice to have as we were missing a test ensuring that trashing and then undoing and redoing it for a directory works as expected Besides these, the following scenarios were manually tested against a remote session on the same machine (macOS): - Trashing → Undo (Restore) → Redo (Trashing) - Batch Trashing → Undo (Batch Restore) → Redo (Batch Trashing) - Rename → Undo (Rename) → Redo (Rename) - Move → Undo (Move) → Redo (Move) - Batch Move → Undo (Batch Move) → Redo (Batch Move) ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [ ] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Release Notes: - N/A --------- Co-authored-by: Yara <git@yara.blue>
68 lines
1.6 KiB
TOML
68 lines
1.6 KiB
TOML
[package]
|
|
name = "fs"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "GPL-3.0-or-later"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/fs.rs"
|
|
test = false
|
|
|
|
[[test]]
|
|
name = "integration"
|
|
required-features = ["test-support"]
|
|
path = "tests/integration/fs_tests.rs"
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
async-channel.workspace = true
|
|
async-tar.workspace = true
|
|
async-trait.workspace = true
|
|
collections.workspace = true
|
|
futures.workspace = true
|
|
git.workspace = true
|
|
gpui.workspace = true
|
|
ignore.workspace = true
|
|
libc.workspace = true
|
|
log.workspace = true
|
|
parking_lot.workspace = true
|
|
paths.workspace = true
|
|
rope.workspace = true
|
|
proto.workspace = true
|
|
thiserror.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
slotmap.workspace = true
|
|
smol.workspace = true
|
|
telemetry.workspace = true
|
|
tempfile.workspace = true
|
|
text.workspace = true
|
|
time.workspace = true
|
|
util.workspace = true
|
|
path.workspace = true
|
|
is_executable = "1.0.5"
|
|
notify = "9.0.0-rc.4"
|
|
trash = { git = "https://github.com/zed-industries/trash-rs", rev = "47761739192828a66b11a94ba5420b82d63c03c5" }
|
|
[target.'cfg(target_os = "windows")'.dependencies]
|
|
windows.workspace = true
|
|
dunce.workspace = true
|
|
async-std.workspace = true
|
|
|
|
[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies]
|
|
ashpd.workspace = true
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
unicode-normalization = "0.1"
|
|
|
|
[dev-dependencies]
|
|
fs = { workspace = true, features = ["test-support"] }
|
|
gpui = { workspace = true, features = ["test-support"] }
|
|
git = { workspace = true, features = ["test-support"] }
|
|
|
|
[features]
|
|
test-support = ["gpui/test-support", "git/test-support", "util/test-support"]
|