Skip to content

Add file explorer modal v2#45307

Closed
baldwindavid wants to merge 8 commits intozed-industries:mainfrom
baldwindavid:browse-from-current-directory
Closed

Add file explorer modal v2#45307
baldwindavid wants to merge 8 commits intozed-industries:mainfrom
baldwindavid:browse-from-current-directory

Conversation

@baldwindavid
Copy link
Contributor

@baldwindavid baldwindavid commented Dec 18, 2025

Closes #45042

This PR implements a modal file browser as an alternative to the project panel. This addresses the feature request from #45042, which proposed enhancing the existing modal that supports the workspace::Open action to be able to function as a general directory explorer.

Background

This builds on the discussion from #43961, which proposed a new dedicated file explorer modal. After maintainer feedback preferring enhancement of an existing picker rather than creating another one, this PR extends the existing OpenPathPrompt with directory navigation capabilities. As noted in #43961, this was the original approach but there were concerns about remote-handling and it perhaps diverging too much from the original intent of the picker.

What's New

Adds two new actions:

workspace::Browse:

  • Opens file picker from the project root
  • Navigate into/out of directories (Enter to go in, ".." to go up)
  • Only allows selecting files (directories are for navigation, not opening as workspaces)
  • Always opens files in the current workspace

workspace::BrowseFromCurrentDirectory:

  • Opens file picker from the current file's directory with that file preselected
  • Same navigation behavior as Browse
  • Useful for finding files near your current location

Both actions work for local and remote projects.

Implementation

Core changes:

  • Added DirectoryListerMode enum (Open vs Browse) to explicitly control picker behavior
  • Extended DirectoryLister to carry mode and optional initial_path
  • Added confirm_update_query() to OpenPathDelegate to navigate into directories instead of opening them as workspaces
  • Forces use of in-app picker when preselect is needed (system picker doesn't support starting in specific directories)
  • OpenPathDelegate derives all context from DirectoryLister (path_style, preselect, browse_mode)

UX details:

  • Browse mode shows folder icons for directories and navigates on Enter
  • ".." entry at top navigates to parent (suppressed at filesystem root)
  • Tab on ".." moves to next item (consistent with existing behavior)
  • Root directory edge cases handled (no duplicate "/", no ".." when no parent)
  • Empty path entries filtered to avoid confusing display

Other Considerations

Tab behavior on ".." entry:
Currently Tab on ".." moves to the next item (matching the existing workspace::Open behavior on "open this directory"). This means that the top entry "skips" while the entries below "autocomplete". It would arguably be more consistent to autocomplete to the parent directory when tabbing this ".." entry, but I tried that and it felt surprising.

Keybindings:
There are none set in this PR currently. I know that I would set - to trigger workspace::BrowseFromCurrentDirectory (muscle-memory from vim-vinegar) and shift- for workspace::Browse, but probably too opinionated as a default.

Screencasts

workspace::Browse

CleanShot 2025-12-18 at 20 04 14

workspace::BrowseFromCurrentDirectory

CleanShot 2025-12-18 at 20 02 46

Release Notes:

  • Added workspace::Browse action to browse and open files via modal (starting from the project root)
  • Added workspace::BrowseFromCurrentDirectory action to browse and open files via modal (starting from the current file's directory)

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 18, 2025
@baldwindavid baldwindavid marked this pull request as ready for review December 19, 2025 01:12
@baldwindavid baldwindavid changed the title Add browse actions via modal Add file explorer modal v2 Dec 19, 2025
@P1n3appl3 P1n3appl3 self-assigned this Dec 19, 2025
* main: (349 commits)
  component_preview: Fix license symlink (zed-industries#46379)
  Do not react on already observed buffer edits' versions (zed-industries#46308)
  Fix EP CLI output flicker (zed-industries#46313)
  vim: Fix bug where repeat operator could lead to unrecoverable replaying state (zed-industries#46376)
  vim: Implement text-based matching bracket logic for Vim '%' motion to correctly find pairs within comments (zed-industries#45559)
  Improve LSP button error message (zed-industries#46377)
  agent: Make reject/accept keybindings consistent with restore/stage (zed-industries#46373)
  Enable test-support features for some dev dependencies (zed-industries#46370)
  Capture terminal output when thread is interrupted (zed-industries#46306)
  Inline assistant tools: no more feature flag (zed-industries#46107)
  Add `ep split` subcommand for dataset splitting (zed-industries#46364)
  lsp_button: Fix long LSP version label (zed-industries#46359)
  remote: Introduce a proper mock remote connection (zed-industries#46337)
  ep: Allow matching patches against files without trailing newlines (zed-industries#46357)
  docs: Update "Custom Keybindings for Extension-Based Agents section" to include a troubleshooting note for defining an agent name (zed-industries#46144)
  Fail early if clangd is downloaded on aarch Linux (zed-industries#46346)
  ep: Handle errored requests in Anthropic batches (zed-industries#46351)
  settings_ui: Fix settings search missing results when BM25 finds partial matches (zed-industries#46349)
  workspace: Unpreview active tab when closing other tabs (zed-industries#46294)
  terminal: Skip SHLVL when loading login shell environment (zed-industries#46273)
  ...
@baldwindavid
Copy link
Contributor Author

Going to hold on this and see how #44530 shakes out and if all pickers move to this sort of design.

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.

Enhance workspace::Open to use as a more general directory explorer

3 participants