Skip to content

project_panel: Fix file missing or duplicated when copying/moving multiple items using drag-n-drop#45567

Merged
smitbarmase merged 10 commits intozed-industries:mainfrom
tacshi:fix/drag_and_drop
Jan 6, 2026
Merged

project_panel: Fix file missing or duplicated when copying/moving multiple items using drag-n-drop#45567
smitbarmase merged 10 commits intozed-industries:mainfrom
tacshi:fix/drag_and_drop

Conversation

@tacshi
Copy link
Contributor

@tacshi tacshi commented Dec 23, 2025

Closes #45555

Refer #20859 for more.

Release Notes:

  • Fixed a project panel drag-and-drop issue where selecting both a folder and its children could result in files being silently lost in some cases.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 23, 2025
@tacshi tacshi changed the title Filter project panel drag-and-drop selections to prioritize parent directories. Filter project panel drag-and-drop selections to prioritize parent directories Dec 23, 2025
Copy link
Member

@smitbarmase smitbarmase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it still throw already exists error on clicking replace in prompt? Since we don't currently handle replacing at worktree_store level:

do_rename(fs.as_ref(), &abs_old_path, &abs_new_path, overwrite).await
. Also I think the logic for checking if same file exists or not should be common between project panel check and worktree store.

I think we should handle this prompt logic at worktree store level instead then.

@smitbarmase
Copy link
Member

smitbarmase commented Jan 6, 2026

Thanks for working on this. If you want, we can split the PR and merge just the disjoint selection part for now. I think it’s basically ready (after a few suggested changes). The replacement prompt can be a separate PR with its own tests.

Edit: I ended up making disjoint changes in your branch. Let me know if you are okay with moving replacement prompt changes to separate PR so that we can get this merge.

Copilot AI review requested due to automatic review settings January 6, 2026 09:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a drag-and-drop bug in the project panel where dragging both a parent folder and its child would incorrectly move them separately instead of moving only the parent with its contents intact.

Key changes:

  • Modified drag-and-drop logic to filter selections and prioritize parent directories, preventing redundant child entries
  • Added conflict detection to prompt users when moving files/folders would cause name collisions
  • Removed premature entry resolution in drag initiation to ensure proper parent-child relationship filtering

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
crates/project_panel/src/project_panel.rs Core logic changes: added conflict detection, moved entry resolution to drag handler, refactored disjoint_entries to be reusable
crates/project_panel/src/project_panel_tests.rs Added comprehensive test coverage for the fix and removed premature resolve_entry calls in existing tests
crates/project_panel/Cargo.toml Added log dependency for error reporting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tacshi
Copy link
Contributor Author

tacshi commented Jan 6, 2026

Thanks for working on this. If you want, we can split the PR and merge just the disjoint selection part for now. I think it’s basically ready (after a few suggested changes). The replacement prompt can be a separate PR with its own tests.

Edit: I ended up making disjoint changes in your branch. Let me know if you are okay with moving replacement prompt changes to separate PR so that we can get this merge.

Sounds good to me. I’m happy to move the replacement prompt changes into a separate PR. Thanks for making the disjoint changes directly, that works for me.

Copy link
Member

@smitbarmase smitbarmase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I removed the replace dialog logic. Looking forward to that PR with suggested changes. Merging this!

@smitbarmase smitbarmase changed the title Filter project panel drag-and-drop selections to prioritize parent directories project_panel: Fix file missing or duplicated when copying/moving multiple items using drag-n-drop Jan 6, 2026
@smitbarmase smitbarmase merged commit d105331 into zed-industries:main Jan 6, 2026
26 checks passed
@tacshi
Copy link
Contributor Author

tacshi commented Jan 6, 2026

Thanks, I removed the replace dialog logic. Looking forward to that PR with suggested changes. Merging this!

Thanks! I’ll follow up with the PR once I get a bit of time. Things have been busy since the holidays ended.

@tacshi tacshi deleted the fix/drag_and_drop branch January 6, 2026 11:36
rtfeldman pushed a commit that referenced this pull request Jan 6, 2026
…tiple items using drag-n-drop (#45567)

Closes #45555

Refer #20859 for more.

Release Notes:

- Fixed a project panel drag-and-drop issue where selecting both a
folder and its children could result in files being silently lost in
some cases.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…tiple items using drag-n-drop (zed-industries#45567)

Closes zed-industries#45555

Refer zed-industries#20859 for more.

Release Notes:

- Fixed a project panel drag-and-drop issue where selecting both a
folder and its children could result in files being silently lost in
some cases.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…tiple items using drag-n-drop (zed-industries#45567)

Closes zed-industries#45555

Refer zed-industries#20859 for more.

Release Notes:

- Fixed a project panel drag-and-drop issue where selecting both a
folder and its children could result in files being silently lost in
some cases.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
…tiple items using drag-n-drop (zed-industries#45567)

Closes zed-industries#45555

Refer zed-industries#20859 for more.

Release Notes:

- Fixed a project panel drag-and-drop issue where selecting both a
folder and its children could result in files being silently lost in
some cases.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag & drop of expanded folders can break directory structure and silently delete same-named files

3 participants