Skip to content

project_panel: Improve file/folder creation behavior in folded paths#46750

Merged
smitbarmase merged 4 commits intozed-industries:mainfrom
andre-eriksson:fix/file-creation-visual
Feb 9, 2026
Merged

project_panel: Improve file/folder creation behavior in folded paths#46750
smitbarmase merged 4 commits intozed-industries:mainfrom
andre-eriksson:fix/file-creation-visual

Conversation

@andre-eriksson
Copy link
Copy Markdown
Contributor

@andre-eriksson andre-eriksson commented Jan 13, 2026

This fix, adds a new field to EditState to track and temporarily unfold the given directory when creating files or directories in collapsed paths.

Closes #45550

Release Notes:

  • Fixed the file and folder creation input appearing in the wrong location when creating inside a collapsed folder path..

Recording:

2026-01-14.00-20-52.mp4

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 13, 2026
Copy link
Copy Markdown
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 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.

Copy link
Copy Markdown
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.

I have provided a few more suggestions:

Also, could you add tests for:

  1. temporarily_unfolded: Creating a file/directory inside a folded directory and verify the editor appears correctly and the directory re-folds after confirm/cancel.
  2. New entry sorting: Creating both files and directories in each sort mode (DirectoriesFirst, Mixed, FilesFirst) to verify placement matches the expected behavior.

andre-eriksson added a commit to andre-eriksson/zed that referenced this pull request Jan 28, 2026
andre-eriksson added a commit to andre-eriksson/zed that referenced this pull request Jan 28, 2026
andre-eriksson added a commit to andre-eriksson/zed that referenced this pull request Jan 28, 2026
andre-eriksson added a commit to andre-eriksson/zed that referenced this pull request Jan 28, 2026
@andre-eriksson
Copy link
Copy Markdown
Contributor Author

andre-eriksson commented Jan 28, 2026

An edge-case that I haven't been able to solve yet is the following scenario:

<root>
- dir/[subdir]/nested
<root>
- dir/[subdir]
- - - nested/
- - - [input]

Now cancel the input by right click dir and start creating a file/folder there:

<root>
- [dir]/subdir/nested
- - - - [input]

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!

Copy link
Copy Markdown
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! The code changes look good. I have a few suggestions before we can merge, sorry for dragging this out a bit longer:

  1. 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.

  2. For the tests, could we reorganize them a bit? The test you added test_ensure_folding_when_creating is 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 the temporarily_unfolded behavior. 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 drop test_ensure_folding_when_deleting since I don't think we need this test, at least not for the changes made in this PR.

  3. 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.

@andre-eriksson
Copy link
Copy Markdown
Contributor Author

Sure here is the edge case example video:

2026-01-29.11-00-22.mp4

Ill work on those fixes and split the PR, thanks!

@andre-eriksson andre-eriksson force-pushed the fix/file-creation-visual branch 3 times, most recently from 6e8d952 to b23ac25 Compare January 29, 2026 12:00
@andre-eriksson andre-eriksson force-pushed the fix/file-creation-visual branch from 1e9263a to f2f0aa9 Compare January 29, 2026 12:26
smitbarmase added a commit that referenced this pull request Feb 6, 2026
…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.
@smitbarmase smitbarmase force-pushed the fix/file-creation-visual branch from e8c9aad to 60923d0 Compare February 9, 2026 14:00
Copy link
Copy Markdown
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.

I added those test cases and handle the context menu case that was breaking. This is a great improvement. Thank you so much!

@smitbarmase smitbarmase changed the title project_panel: Fix unclear UI during file/directory creation project_panel: Improve file/folder creation behavior in folded paths Feb 9, 2026
@smitbarmase smitbarmase merged commit bf2171d into zed-industries:main Feb 9, 2026
28 checks passed
@andre-eriksson andre-eriksson deleted the fix/file-creation-visual branch February 9, 2026 14:59
naaiyy added a commit to Glass-HQ/Glass that referenced this pull request Feb 16, 2026
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]>
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.

File creation is inconsistent with result

3 participants