45c0ced
cli: Add first-run prompt for default open behavior and abstract IPC transport (#53663)
Click to expand commit body
This PR adds the `cli_default_open_behavior` setting and a first-run TUI
prompt
that appears when `zed <path>` is invoked without flags while existing
windows are
open and the setting hasn't been configured yet.
## What it does
### Setting and prompt
- Adds a new `cli_default_open_behavior` workspace setting with two
values:
`existing_window` (default) and `new_window`.
- When the user runs `zed <path>` for the first time with existing Zed
windows
open, a `dialoguer::Select` prompt in the CLI asks them to choose their
preferred behavior. The choice is persisted to `settings.json`.
- The prompt is skipped when:
- An explicit flag (`-n`, `-e`, `-a`) is given
- No existing Zed windows are open
- The setting is already configured in `settings.json`
- The paths being opened are already contained in an existing workspace
### IPC transport abstraction
- Introduces a `CliResponseSink` trait in the `cli` crate that abstracts
`IpcSender<CliResponse>`, with an implementation for the real IPC
sender.
- Replaces `IpcSender<CliResponse>` with `Box<dyn CliResponseSink>` /
`&dyn CliResponseSink` across all signatures in `open_listener.rs`:
`OpenRequestKind::CliConnection`, `handle_cli_connection`,
`maybe_prompt_open_behavior`, `open_workspaces`, `open_local_workspace`.
- Extracts the inline CLI response loop from `main.rs` into a testable
`cli::run_cli_response_loop` function.
- Switches the request channel from bounded `mpsc::channel(16)` to
`mpsc::unbounded()`, eliminating `smol::block_on` in the bridge thread.
### End-to-end tests
Seven new tests exercise both the CLI-side response loop and the
Zed-side
handler connected through in-memory channels, using `allow_parking()` so
the
real `cli::run_cli_response_loop` runs on an OS thread while the GPUI
executor
drives the Zed handler:
- No flags, no windows → no prompt, opens new window
- No flags, existing windows, user picks "existing window" → prompt,
setting persisted
- No flags, existing windows, user picks "new window" → prompt, setting
persisted
- Setting already configured → no prompt
- Paths already in existing workspace → no prompt
- Explicit `-e` flag → no prompt
- Explicit `-n` flag → no prompt
Existing tests that previously used `ipc::channel()` now use a
`DiscardResponseSink`, removing OS-level IPC from all tests.
Release Notes:
- Added a first-run prompt when using `zed <path>` to choose between
opening
in an existing window or a new window. The choice is saved to settings
and
can be changed later via the `cli_default_open_behavior` setting.
---------
Co-authored-by: Nathan Sobo <nathan@zed.dev>
ba7d30a
Fix agent panel font size incrementing by 2px instead of 1px
Click to expand commit body
Split the shared AgentFontSize in-memory global into separate
AgentUiFontSize and AgentBufferFontSize globals. Previously, both
adjust_agent_ui_font_size and adjust_agent_buffer_font_size read from
and wrote to the same global, so calling them back-to-back in
handle_font_size_action applied the delta twice.
The go-subtest task template wrapped the -run arg in single quotes
for shell safety. This works for Run Test (terminal strips quotes),
but Debug Test sends the arg through Delve's DAP protocol with no
shell involved, so the literal quote characters ended up in the
regex and prevented any match.
All other Go task templates (go-test, go-testify-suite,
go-table-test-case) use the backslash-escaped format which the
GoLocator already knows how to handle. Align the go-subtest
template to the same format.
3ae326a
gpui: Stub out prompt_for_paths in TestPlatform
Click to expand commit body
Add stubbing support for prompt_for_paths in TestPlatform, following the
same pattern as prompt_for_new_path. This allows tests to simulate user
interactions with the file open dialog.
- Add paths field to TestPrompts to store pending prompts
- Add did_prompt_for_paths() to check for pending prompts
- Add simulate_paths_selection() to simulate user path selection
- Update prompt_for_paths() to queue prompts instead of panicking
- Expose these methods on TestAppContext and TestApp
4032a44
Clean up empty parent directory after archiving worktree
Click to expand commit body
Zed creates worktrees at <worktrees_dir>/<branch_name>/<project_name>/.
When git worktree remove deletes the inner project directory, the
intermediate branch directory is left behind as an empty folder.
After a successful git worktree remove, check if the parent directory
is now empty AND is inside Zed's managed worktrees directory (from
the git.worktree_directory setting). If both conditions are met,
remove the empty parent. Directories outside the managed worktrees
directory are never touched, so user-created worktrees at custom
paths won't have their parent directories deleted.
addfcab
Add test for archive cleanup with diverged workspace paths
Click to expand commit body
Tests the scenario where a thread's folder_paths don't exactly match
any workspace's root paths (e.g. after a folder was added to the
workspace post-creation). In this case, workspace_to_remove is None
because workspace_for_paths can't find an exact match, but the linked
worktree workspace still has the worktree loaded with open editors
holding Entity<Worktree> references.
Without the fix, the archive cleanup task's wait_for_worktree_release
hangs forever because the workspace's editors prevent the worktree
entity from being released, and the worktree directory is never
cleaned up from disk.
da8be4d
WIP: Introduce ProjectGroup as explicit entity owning workspaces
Click to expand commit body
Replace the old system where project groups were identified by
ProjectGroupKey (structural path-based identity) with three parallel
collections joined on every read, with a new system where:
- Each ProjectGroup has a stable ProjectGroupId (UUID)
- ProjectGroup directly contains its Vec<Entity<Workspace>>
- MultiWorkspace.active_workspace is a plain Entity<Workspace>
- The ActiveWorkspace enum (Transient/Persistent) is removed
Structural changes:
- persistence/model.rs: SerializedProjectGroupKey -> SerializedProjectGroup
with Option<ProjectGroupId> for backward compat
- multi_workspace.rs: ProjectGroup struct, replaces workspaces vec +
project_group_keys vec + workspace_group_keys HashMap
- workspace.rs: Updated re-exports and restore logic
- sidebar.rs: Uses ProjectGroupId for collapsed/expanded state
- recent_projects.rs: Looks up group by key to get ID for removal
Known issues (11 sidebar test failures):
- 6 tests fail because activate() only adds workspaces to groups when
sidebar is open. Need to decide: always track, or gate on sidebar.
- 5 tests fail because handle_workspace_key_change no longer migrates
thread metadata (old WorktreePathAdded/Removed events removed).
These will be addressed when ThreadMetadataStore gets project_group_id.
workspace tests: 160/160 pass
agent_ui tests: 229/230 pass (1 pre-existing flaky)
cd09ffc
edit_predictions_ui: Enforce org configuration to disable Zed provider
Click to expand commit body
The Zed provider is now disabled in the selection dropdown when the current organization has disabled edit predictions. It is also unselected when you switch organizations to one such organization.
This is also already enforced server side.
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
04acf3a
Set active repository when picking a root folder in recent project menu (#53645)
Click to expand commit body
This changes the behavior of the recent project picker in multi-folder
projects, so that when you select a folder that is a repository, it sets
the active repository in the Git panel as well.
Release Notes:
- N/A
c31c03e
gpui_wgpu: Fix WGPU panic from unsupported atlas texture formats
Click to expand commit body
We were assuming that `Bgra8Unorm` always works, which was causing the panic on devices that don't ("wgpu-hal invariant was violated: Requested feature is not available on this device")
This change makes a proper fallback to Rgba8Unorm. In the worst case, if a device doesn't support that as well (highly unlikely), we return a proper error instead of a panic.