project_panel: Improve file/folder creation behavior in folded paths#46750
Conversation
7e9954d to
71898d5
Compare
smitbarmase
left a comment
There was a problem hiding this comment.
Thanks for the PR! This is a great UX improvement. I've left a suggestion about the temporarily_unfolded cleanup pattern. Let me know what you think.
smitbarmase
left a comment
There was a problem hiding this comment.
I have provided a few more suggestions:
Also, could you add tests for:
temporarily_unfolded: Creating a file/directory inside a folded directory and verify the editor appears correctly and the directory re-folds after confirm/cancel.- New entry sorting: Creating both files and directories in each sort mode (
DirectoriesFirst,Mixed,FilesFirst) to verify placement matches the expected behavior.
|
An edge-case that I haven't been able to solve yet is the following scenario: Now cancel the input by right click Finishing that input puts the file under dir/subdir which is incorrect, so both where the file is meant to go and where it is displayed is wrong. It is also quite annoying to debug since it requires multi-step interactions, wondering if you could potentially give some directions or advice here. Note: It is also inconsistent, take the same scenario but this time starting with nested, but it works? Other than that, everything seems to work nicely! Thanks for your feedback! |
smitbarmase
left a comment
There was a problem hiding this comment.
Thanks! The code changes look good. I have a few suggestions before we can merge, sorry for dragging this out a bit longer:
-
I feel this should be two separate PRs. One for the folding fix with its tests, and one for the sort mode placement. Would you mind splitting these up? We can keep this PR focused on the folding file creation fix.
-
For the tests, could we reorganize them a bit? The test you added
test_ensure_folding_when_creatingis basically testing that files end up in the correct location when creating them in a folded directory after confirming, which is good to have since we don't already have these tests. But we should add a separate test specifically for thetemporarily_unfoldedbehavior. That is, assert that the directory temporarily unfolds to show the editor in the correct location, and that after cancel, it re-folds back to its original state. Also, let's droptest_ensure_folding_when_deletingsince I don't think we need this test, at least not for the changes made in this PR. -
I tried to reproduce the edge case you mentioned but couldn't. I think adding the above test will make it visible if there's a bug. But if you can share a video with me, maybe I can suggest what's going on.
|
Sure here is the edge case example video: 2026-01-29.11-00-22.mp4Ill work on those fixes and split the PR, thanks! |
6e8d952 to
b23ac25
Compare
1e9263a to
f2f0aa9
Compare
…tor blurs (#48578) Prep for: #46750 Edit-state cleanup in the Project Panel was inconsistent between Escape cancel and blur. Blurring the filename editor during file/folder creation could clear edit state without restoring the previous selection. This routes both paths through the same discard flow and adds test coverage for the blur case. Release Notes: - Fixed an issue where blurring the filename editor in the Project Panel could lose the previous selection while creating a file or folder.
e8c9aad to
60923d0
Compare
smitbarmase
left a comment
There was a problem hiding this comment.
I added those test cases and handle the context menu case that was breaking. This is a great improvement. Thank you so much!
Key changes: - Side-by-side diff UX improvements (zed-industries#48821) - major diff view polish - Display map refactoring - large cleanup of display_map.rs (~1000 line reduction) - Split editor growth (zed-industries#48753) - significant expansion of split.rs - Multi-char folds fix (zed-industries#48721) - New multi workspace (zed-industries#47795, then reverted zed-industries#48776) - Default view mode setting for SplittableEditor (zed-industries#48440) - macOS drag-drop fix: reset external_files_dragged (zed-industries#48727) - Windows: OS caption/buttons for custom titlebar (zed-industries#48330) - Windows timer resolution guard (zed-industries#48379) - Bedrock Claude Opus 4.6 model (zed-industries#48525) - MCP servers: fix disabled servers disappearing after restart (zed-industries#47758) - Shell command parser extracted to shared crate (zed-industries#48660) - Format-on-save for streaming edit file tool (zed-industries#48663) - Agent: insert images at cursor position (zed-industries#48779) - Project panel: improved file/folder creation in folded paths (zed-industries#46750) - Folding ranges panic fix (zed-industries#48809) - REPL: shutdown all kernels on app quit (zed-industries#48760) - Extension CI improvements - Security updates: time v0.3.47, git2 v0.20.4 Conflict resolution: - collab (Cargo.toml, extensions API, db, tests): deleted - GPUI (8 files): deleted from Glass (handled in Obsydian-HQ/gpui) - Cargo.lock: took upstream Co-Authored-By: Claude Opus 4.6 <[email protected]>
This fix, adds a new field to
EditStateto track and temporarily unfold the given directory when creating files or directories in collapsed paths.Closes #45550
Release Notes:
Recording:
2026-01-14.00-20-52.mp4