Commit graph

409 commits

Author SHA1 Message Date
Anthony Eid
cc20ae3fb5
workspace: Always add projects to windows (#56187)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Right now the recent project picker has different confirm behavior
depending on if a user had open their sidebar in their current Zed
session. If the sidebar had been open the recent project picker adds the
selected project to the multi workspace and makes it the active
workspace, without removing anything. If the sidebar hadn't been open
the recent project picker would replace the active workspace within the
multi workspace.

This caused confusion because the same UX flow had two different
outcomes depending on Zed's state that wasn't obvious to users. This PR
mitigates this by always adding the project to the window while AI
features are enabled. Future follow ups will include the ability to
disable the sidebar, but that's blocked on the agent panel not having a
way to view active threads currently.

This also caused issues in the parallel agents workflow because
replacing a workspace would drop the workspace, thus causing any
terminal processes or threads to be dropped as well.


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-09 01:54:42 +00:00
Smit Barmase
4e28b0a3fc
recent_projects: Allow bulk deleting entries without scroll jumping (#54777)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_style (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / extension_tests (push) Blocked by required conditions
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Closes #52292

This PR preserves the scroll offset of the List used in Recent Projects
while deleting items. It does that by:
- Adding the `is_scrolled_to_end` method to the GPUI list, which helps
us determine where the new selection should be, since it depends on
whether items are taking the deleted slot from below or above.
- Adding `ScrollBehavior` to `update_matches`, which lets you preserve
the scroll offset even for `List` (not `UniformList`) after a reset.

Before:


https://github.com/user-attachments/assets/e3eb7092-59ec-4b54-b57a-503555addd27

After:


https://github.com/user-attachments/assets/6929f6a0-04d7-44f9-a9b2-f9e5c077b368

Release Notes:

- Fixed the recent projects list jumping to the top after deleting a
project, so you can now bulk-delete entries by repeatedly clicking the
delete icon or pressing the keybind.
2026-05-06 14:06:48 +00:00
Conrad Irwin
be705e677b
Merge gpui::Task and scheduler::Task (#53674)
Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-05 22:41:13 +00:00
Max Brunsfeld
0fd49c840a
Improve grouping of worktrees by repo in recent projects (#55715)
* Perform grouping even for repositories that have no main worktree
* Enable grouping for remote projects
* Delete entire project groups when deleting via the recent project
picker

Release Notes:

- Fixed a bug where each linked worktree appeared as its own entry in
recent projects for repositories without main worktrees
- Fixed a bug where deleting projects from the recent projects sometimes
appeared to have no effect.
2026-05-05 08:21:03 +00:00
Danilo Leal
c7491e430b
recent_projects: Add "open in new window" action to opened projects (#55168)
This PR adds a "open in new window" button to the projects that are
already open in the current window. This matches a capability that was
only available through the threads sidebar.

<img width="500" alt="Screenshot 2026-04-29 at 11  28@2x"
src="https://github.com/user-attachments/assets/b5c890fd-d21b-483b-b428-0f96b40aa7fc"
/>

Release Notes:

- Added the ability to move a currently open project to a new window
through the recent projects modal.
2026-04-29 11:38:03 +00:00
Yara 🏳️‍⚧️
320888142f
Rust 1.95 (#55104)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-04-29 10:27:47 +00:00
Lukas Wirth
c5a2807492
Remove smol as a dependency from a bunch of crates (#53603)
We aren't making use of it in these crates and it unblocks some
web-related work

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-24 10:29:51 +00:00
Finn Evers
9b40411c6a
Fix bad GitHub merge queue merge (#54721)
No, sadly, the title is not a typo. See
https://www.githubstatus.com/incidents/zsg1lk7w13cf for the context.
I'll read with joy and popcorn through that root cause analysis.

It makes literally zero sense what happened here, but for some completly
bonkers reason GitHub completely messed up the merge queue with
https://github.com/zed-industries/zed/pull/54632.

I have no idea how it happened. It makes literally zero sense. A PR
going into the merge queue should have the same LoC when getting out of
it. GitHub obviously does not check this. GitHub causes extra work with
a feature that is supposed to save time.

Thanks, I guess.

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-23 23:47:30 +00:00
Danilo Leal
0ab64d6414
branch_picker: Add button to filter remote branches (#54632)
This PR brings back the button to filter remote branches when accessing
the title bar's branch picker with the mouse. It was unintentionally
removed when we introduced the new worktree picker.

Release Notes:

- N/A
2026-04-23 18:26:44 +00:00
Danilo Leal
3eb0bab077
recent_projects: Add some UI improvements (#54629)
- Adds a "Current Folders" header for the multi-root group
- Improves the project/branch truncation and active checkmark
positioning for project list item
- Add folder-type icons for the list items within the "This Window"
group
- Refine lanaguage in buttons and tooltips so they're more consistent

<img width="400" alt="Screenshot 2026-04-23 at 6  23@2x"
src="https://github.com/user-attachments/assets/02131a6c-0956-46bb-8def-af57df5b0b9e"
/>

Release Notes:

- N/A
2026-04-23 15:12:32 +00:00
galuis116
5df4e1eaa0
recent_projects: Fix remote projects dialog not showing vertical scrollbar for overflow content (#54425)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #54424

Release Notes:

- N/A

Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
2026-04-21 20:39:06 -03:00
Max Brunsfeld
f9cb919cba
Tweak wording around multi-folder project actions (#54438)
* Project panel "Add Folders to Project" and "Remove folder from
Project"
* Recent projects "Add Folders to this Project"

Release Notes:

- N/A
2026-04-21 17:34:37 +00:00
allison
1ea6eb4d42
workspace: Fix recent-projects cleanup wiping active workspaces (#54224)
The recent-projects picker, sidebar, welcome screen, and agent thread
store all called `recent_workspaces_on_disk`, which combined listing
with deleting stale rows. Its retention predicate rejected workspaces
with no on-disk directory, including empty workspaces holding unsaved
scratch buffers, and the resulting `delete_workspace_by_id` call
cascaded into `items`, `pane_groups`, and the per-editor tables. For
clarity, the method has been renamed to `recent_workspaces_for_ui`.

Meanwhile, `last_session_workspace_locations` used a slightly different
form of the same predicate. The two disagreeing on what counts as a
valid workspace caused #48799, `Workspace WorkspaceId(N) not found`
errors on repeated launches (#50409), the
`test_window_edit_state_restoring_enabled` flake (#50871), and the
foreign key constraint fail on `projects: open recent` with a dirty
scratch buffer (#51456).

Note that for the last issue mentioned (#51456) there is no save prompt
for scratch buffers. This seems out of scope for this PR so I'll fix
that after this is addressed.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #48799 
Closes #50409 
Closes #50871
Closes #51456 

Release Notes:

- Fixed unsaved scratch buffers being lost across restarts and an
occasional error when opening a recent project.
2026-04-21 16:44:18 +00:00
Jason Lee
84dcf38dbe
gpui: Improve Anchored to support center position (#47154)
Release Notes:

- N/A

Ref https://github.com/longbridge/gpui-component/pull/1956 extract my
fork version of `anchored.rs` to let GPUI to support position Anchored
at center.


https://github.com/user-attachments/assets/8d0230ed-4b75-440b-b8c3-9bde3decd141

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 09:01:42 +00:00
galuis116
f37df7b78d
recent_projects: Fix unaligned keybinding labels in quick-switch menu (#54325)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #54324 

Release Notes:

- Fixed shortcut label alignment in the Recent Projects quick-switch
footer by rendering action rows with a consistent two-column layout
(label left, keybinding right) for “Add Local Folders” and “Add Remote
Folder”.

---------

Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
2026-04-20 15:29:58 -03:00
galuis116
4854ad98db
Improve button keybinding alignment in workspace switcher (#54300)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #54299 

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
2026-04-20 10:16:57 -03:00
Finn Eitreim
68541960a7
fuzzy_nucleo: Add strings module and route several pickers through it (#54123)
Stacked on top of #54112
This is part 2 of 3 towards #51197
More details from the original PR #53551

This PR includes the changes from #54112 , im not sure how to avoid
that, my understanding is that after that one is merged, this PR can be
rebased onto main and everything will be correct. You can also view the
version of this that does reflect the changes more directly here:
https://github.com/feitreim/zed/pull/1

## Changes

In this PR I added a more general string matching functionality to
`fuzzy_nucleo`, in order to have proper testing for this, I also changed
the command palette, tab switching picker, branch picker, and recent
projects picker to use this new implementation. I think the command
palette change in particular is awesome, just super nice to vaguely
gesture at the command i want and have it pop right up.

The main change here and departure from
https://github.com/zed-industries/zed/pull/37123 is realizing that the
primary reason for the regressions is actually how nucleo handles smart
case, the old `fuzzy` crate only uses the smart case argument to score
things differently, while nucleo actually filters on the case, eg. with
smart case query "Apple" wouldnt match "apple". To get around this we
always pass `CaseMatching::Ignore` to nucleo and implement the same
score modifications from fuzzy in our code.

There is a performance cost to that, of course, but from my testing it
is fairly static, not growing as the size increases, so maybe a query
takes 35 µs instead of 25 µs, but a query that takes 800 µs will only
take 820 µs.

Benchmark:
| kind | query | size | nucleo | fuzzy | nucleo/fuzzy |
  |---|---|---:|---:|---:|---:|
  | string | 1-word | 100 | 9.15 µs | 24.6 µs | 0.37× |
  | string | 1-word | 1000 | 150.2 µs | 207.2 µs | 0.72× |
  | string | 1-word | 10000 | 1.34 ms | 2.07 ms | 0.65× |
  | string | 2-word | 100 | 5.16 µs | 2.94 µs | 1.75× |
  | string | 2-word | 1000 | 29.0 µs | 11.0 µs | 2.63× |
  | string | 2-word | 10000 | 210.6 µs | 55.5 µs | 3.79× |
  | string | 4-word | 100 | 2.57 µs | 2.33 µs | 1.10× |
  | string | 4-word | 1000 | 6.98 µs | 5.85 µs | 1.19× |
  | string | 4-word | 10000 | 20.0 µs | 12.0 µs | 1.66× |

When I added the 4-word queries to the benchmarks I was actually really
concerned that the performance would be awful, making it unsuitable for
the command palette especially. However, I think due to the CharBag
pre-filtering when the query is longer, the performance is actually way
better than the 2 word case.

Video:


https://github.com/user-attachments/assets/3cd7221b-424f-4fd3-8df1-5543dcc340a3

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Improved fuzzy matching in the command palette, branch picker, tab
switcher, and recent projects picker to support multi-word queries.

---------

Co-authored-by: Yara <git@yara.blue>
2026-04-20 14:41:29 +02:00
Smit Barmase
559fcff870
recent_projects: Show project name in dev container suggestion notification (#54297)
Closes #52587

Release Notes:

- Improved the Dev Container suggestion notification to include the
project name, with the full path shown as a tooltip.
2026-04-20 15:28:15 +05:30
Danilo Leal
9daf886775
Move the worktree picker to the title bar + make it always visible (#54183)
This PR makes Zed only have one worktree picker, as opposed to a flavor
of it in the title bar and another in the agent panel. It then moves it
to the title bar, making it always present, so that its trigger is
separate from the branch picker (which now contains only two views:
branches and stashes). For the worktree picker, I'm mostly favoring the
behavior we've introduced in the agent-panel-flavored version.

It also updates the title bar settings migration to use the JSON
`migrate_settings` helper instead of a shallow Tree-sitter rewrite, so
old `show_branch_icon = true` values are promoted to
`show_branch_status_icon = true` across root, platform, release-channel,
and profile settings scopes.

- [x] Move worktree creation logic to the `git_ui` crate to make this
more generic and less agent-specific
- [x] Double-check the remote use case and ensure nothing broke there
- [x] Improve the UX for the detached HEAD state; better invite people
to create a branch
- [x] Migrate `show_branch_icon = true` to `show_branch_status_icon =
true` across nested settings scopes

Suggested .rules additions

When migrating renamed settings keys that can appear in platform
overrides, release-channel overrides, or profiles, prefer the JSON
`migrations::migrate_settings` helper over shallow Tree-sitter key
rewrites unless tests explicitly cover every nested scope that can
contain the key.

Release Notes:

- Improved migration of the title bar branch status icon setting.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-04-20 09:29:51 +00:00
Cole Miller
81072ebe1d
Remove flakytest_dev_container_modal_not_dismissed_on_background_click (#54062)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-04-16 12:57:29 +00:00
Cameron Mcloughlin
f81a5ecabd
workspace: Native open dialog multi-select (#53963) 2026-04-15 10:18:10 +01:00
Danilo Leal
6beecae6df
agent_ui: Improve the new thread worktree UX (#53941)
Closes https://github.com/zed-industries/zed/issues/53262

- Remove the ability to pick a branch from the agent panel; delegate
this to the title bar picker
- Make the worktree creation earger, just as you selected whether you
want to create it from main or current branch
- Remove flicker when creating a new worktree and switching to a
previously existing one
- Improve some UI stuff: how we display that a worktree is
creating/loading, the branch and worktree icons, etc.
- Fixed a bug where worktrees in a detached HEAD state wouldn't show up
in the worktree pickers

A big part of the diff of this PR is the removal of everything involved
with the `StartThreadIn` enum/the set up involved in only creating the
worktree by the time of the first prompt send.

Release Notes:

- Agent: Improved and simplified the UX of creating threads in Git
worktrees.
- Git: Fixed a bug where worktrees in a detached HEAD state wouldn't
show up in the worktree picker.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2026-04-15 03:47:19 +00:00
Nathan Sobo
f49d9324db
sidebar: Simplify project group menu (#53933)
Remove the ability to add and remove individual folders from project
groups in the sidebar.

## Changes

**Sidebar project group menu:**
- When there are 2+ local project groups, the ellipsis menu shows "Open
Project in New Window" and "Remove Project" (no separators, no folder
listing)
- When there's only one group or it's remote, the ellipsis menu is
replaced with a close X button that removes the project directly

**Project picker labels:**
- "Open Local Project" → "Open Local Folders"
- "Open Remote Project" → "Open Remote Folder"
- "Add Local Project" → "Add Local Folders"
- "Add Remote Project" → "Add Remote Folder"

**Dead code removal:**
- `MultiWorkspace::remove_folder_from_project_group`
- `MultiWorkspace::prompt_to_add_folders_to_project_group`
- `MultiWorkspace::add_folders_to_project_group`
- `MultiWorkspace::update_project_group_key`
- `MultiWorkspaceEvent::ProjectGroupKeyUpdated`
- `Sidebar::move_threads_for_key_change`
- `ThreadMetadataStore::change_worktree_paths_by_main`
- Associated tests for removed functionality

Per-workspace thread regrouping (when a workspace's worktree paths
change) continues to work via the existing `WorktreePathsChanged` →
`move_thread_paths` flow. The existing
`test_worktree_add_only_regroups_threads_for_changed_workspace` test
(renamed and strengthened) verifies that only the changed workspace's
threads are regrouped, while sibling worktree threads remain in their
original group.

Release Notes:

- Improved sidebar project group menu to show a simple close button for
single-project windows and a streamlined two-item menu for multi-project
windows.
2026-04-14 20:12:11 -06:00
Danilo Leal
c8b3da6ed9
recent_projects: Fix clipping branch and project name (#53906)
Just fixing an issue where the project and branch labels weren't
truncating in the project popover.

<img width="600" height="1054" alt="Screenshot 2026-04-14 at 11  49@2x"
src="https://github.com/user-attachments/assets/eefa5027-34cd-41da-9590-cb12a89cdb51"
/>

Release Notes:

- N/A
2026-04-14 13:44:05 -03:00
Anthony Eid
eed33ab283
sidebar: Fallback to main git worktree path when opening thread in deleted git worktree (#53899)
### Summary

This PR is the first step in improving Zed's error handling when a user
opens an old thread that's associated with a deleted git worktree.
Before, the thread would open in an empty project with a broken state.
This PR instead opens the thread in the workspace associated with the
thread’s main git worktree when available.

### Follow ups

1. Implement remote support for this fallback 
2. Update `ThreadMetadataStore` database to set paths from deleted
worktree to the main worktree
3. If the main git worktree is deleted as well, fallback to the
currently active workspace

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-04-14 09:17:29 -07:00
Richard Feldman
1150c9d664
Fix crash when fallback workspace is in the removal set (#53549)
When removing a project group, the fallback closure calls
`find_or_create_local_workspace` which searches `self.workspaces` for an
existing match. Because the workspaces to be removed haven't been
removed yet at that point, `workspace_for_paths` can return a doomed
workspace, hitting the `assert!` in `MultiWorkspace::remove` and
crashing the app.

Fix by adding an `excluding` parameter to
`find_or_create_local_workspace` so callers inside removal fallbacks can
skip workspaces that are about to be removed. Both
`remove_project_group` and `sidebar::archive_thread` now pass the
appropriate exclusion set.

Adds a regression test that deterministically reproduces the crash (the
assert fires without the exclusion, passes with it).

Release Notes:

- Fixed a crash when closing a project group whose fallback workspace
matched one being removed.
2026-04-13 16:30:38 -04:00
Nathan Sobo
55e47138e9
agent_ui: Unify draft and background threads into retained threads (#53737)
> **Foundation PRs:** #53732, #53733, #53734 — These three draft PRs
contain the base refactors (retained workspaces, agent panel overlay
split, ThreadId introduction) that this PR builds on.

## Goal

Remove `DraftId` and merge `draft_threads` + `background_threads` into a
single `retained_threads: HashMap<ThreadId, Entity<ConversationView>>`
in `AgentPanel`. A draft is just a thread that hasn't sent its first
message — no separate identity or storage needed.

## Changes

### agent_panel.rs
- Remove `DraftId` / `DraftIdCounter` / the `Global` impl
- Merge the two maps into `retained_threads`
- Add `thread_id: ThreadId` field to `BaseView::AgentThread`
- Rename methods: `create_draft` → `create_thread`, `activate_draft` →
`activate_retained_thread`, `remove_draft` → `remove_thread`, etc.
- Replace `clear_active_thread` with `show_or_create_empty_draft`
- Update `update_thread_work_dirs` to sync `ThreadMetadataStore` paths
when worktrees change
- Keep `load_agent_thread(...)` cleanup so activating a real thread
removes empty retained drafts

### sidebar.rs
- Remove `active_entry` derivation from `rebuild_contents` (was racing
with deferred effects)
- Add `sync_active_entry_from_panel` called from event handlers instead
- Simplify `ActiveEntry` — remove `ThreadActivation` struct, make
`session_id` optional
- Move `seen_thread_ids` to global scope (was per-group, causing
duplicate thread entries)
- Remove dead code: `clear_draft`, `render_draft_thread`
- Generalize `pending_remote_thread_activation` into
`pending_thread_activation` so all persisted-thread activations suppress
fallback draft reconciliation
- Set the activation guard before local persisted-thread activation
switches workspaces
- Make `reconcile_groups(...)` bail while a persisted-thread activation
is in flight
- On `ActiveViewChanged`, clear empty group drafts as soon as a pending
persisted-thread activation resolves

### thread_metadata_store.rs
- Make `ThreadMetadata.title` an `Option<SharedString>` with
`display_title()` fallback
- Add `update_worktree_paths` for batched path updates when project
worktrees change

### Other crates
- Update all `ThreadMetadata` construction sites and title display sites
across `agent_ui` and `sidebar`

## Fallback draft invariant

This PR now tightens the retained-thread invariant around fallback
drafts vs real thread activation/restoration:

- Fallback drafts are always empty
- User-created drafts worth preserving are non-empty
- While a persisted thread is being activated/restored/loaded, sidebar
reconciliation must not create an empty fallback draft for that target
group/workspace
- Once the real thread becomes active, empty fallback drafts in that
target group are removed

This is enforced by the sidebar-side activation guard plus existing
`AgentPanel` empty-draft cleanup after real-thread load.

## Tests

Added and/or kept focused sidebar regression coverage for:

-
`test_confirm_on_historical_thread_in_new_project_group_opens_real_thread`
-
`test_unarchive_into_inactive_existing_workspace_does_not_leave_active_draft`
-
`test_unarchive_after_removing_parent_project_group_restores_real_thread`
- `test_pending_thread_activation_suppresses_reconcile_draft_creation`

Focused test runs:

- `cargo test -p sidebar activate_archived_thread -- --nocapture`
- `cargo test -p sidebar unarchive -- --nocapture`
- `cargo test -p sidebar archive_last_thread_on_linked_worktree --
--nocapture`
- `cargo test -p sidebar
test_confirm_on_historical_thread_in_new_project_group_opens_real_thread
-- --nocapture`
- `cargo test -p sidebar
test_unarchive_into_inactive_existing_workspace_does_not_leave_active_draft
-- --nocapture`
- `cargo test -p sidebar
test_unarchive_after_removing_parent_project_group_restores_real_thread
-- --nocapture`
- `cargo test -p sidebar
test_pending_thread_activation_suppresses_reconcile_draft_creation --
--nocapture`

## Test fix

Fixed flaky `test_backfill_sets_kvp_flag` — added per-App `AppDatabase`
isolation in `setup_backfill_test` so backfill tests no longer share a
static in-memory DB.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2026-04-13 09:07:09 +00:00
Max Brunsfeld
cca6552bc4
Open new remote projects in the same window via sidebar (#53654)
Previously, when opening a remote project via the sidebar, and picking a
new project path via the path picker, it would incorrectly open in a new
window.

Release Notes:

- N/A
2026-04-10 14:29:03 -07:00
Max Brunsfeld
b15969086e
Set active repository when picking a root folder in recent project menu (#53645)
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
2026-04-10 12:12:42 -07:00
Richard Feldman
5d32b56e07
Disambiguate project names (#52848)
Disambiguate project names in the sidebar (and project picker) so that
we don't show e.g. `zed, zed` but rather `foo/zed, bar/zed` if the last
path component is the same but they are different absolute paths.

Release Notes:

- N/A
2026-04-09 14:11:55 -04:00
Eric Holk
d812adc833
sidebar: Better handling for threads in remote workspaces (#53451)
This PR greatly improves our handling of remote threads in the sidebar.

One primary issue was that many parts of the sidebar were only looking
at a thread's path list and not its remote connection information. The
fix here is to use `ProjectGroupKey` more consistently throughout the
sidebar which also includes remote connection information.

The second major change is to extend the MultiWorkspace with the ability
to initiate the creation of remote workspaces when needed. This involved
refactoring a lot of our remote workspace creation paths to share a
single code path for better consistency.

Release Notes:

- (Preview only) Fixed remote project threads appearing as a separate
local project in the sidebar

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-04-09 06:56:28 +00:00
Mikayla Maki
6286b7c5fb
Fix workspace removal, and chase down all the ramifications (#53366)
This PR adjusts how project group removal works in the sidebar to be
project group aware. Removal is now a batched operation, and supports a
contextually appropriate fallback active workspace fallback. In the
process of removing this, I had to chase down and fix other broken code:
- Removes the "move to new window" actions
- Changed the sidebar to store things in "most recently added" order
- The recent project UI was still using workspaces, instead of project
groups
- Adjusted the archive command to use the new APIs to remove the
workspace associated with that worktree (cc: @rtfeldman)
- The property tests where still using indexes and workspaces instead of
project groups

Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-04-08 09:21:39 +00:00
Danilo Leal
833a015dc6
recent_projects: Make the currently active project visible in the picker (#53302)
This PR improves the recent projects picker in the context of
multi-workspace:

- The currently active project now appears in the "This Window" section
with a checkmark indicator. Clicking it simply dismisses the picker,
since there's nothing to switch to. This feels like a better UX because
it gives you visual confirmation of where you are.
- The remove button is hidden for the current project entry, both in the
row and the footer, to prevent accidentally removing the workspace
you're actively using.
- The "Add to Workspace" button now uses a more descriptive icon
(`FolderOpenAdd`) and shows a meta tooltip clarifying that it adds the
project as a multi-root folder project.

The primary click/enter behavior remains unchanged—it opens the selected
project in the current window's multi-workspace. The "Open in New
Window" action continues to be available via the icon button or
shift+enter.

Release Notes:

- Improved the recent projects picker to show the currently active
project in the "This Window" section with a checkmark indicator.
2026-04-07 12:44:19 -03:00
Mikayla Maki
a018333d41
Introduce the temporary/retained workspace behavior based on whether the sidebar is open (#53267)
Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-04-06 21:42:04 +00:00
Toni Alatalo
f3c034ef2b
Prevent dev container modal dismissal during creation (#52506)
## Context

When the dev container creation modal is showing "Creating Dev
Container", clicking anywhere on the workspace backdrop dismisses the
dialog. The container creation continues in the background, but the user
loses visual feedback and the subsequent `open_remote_project` call may
fail because the modal entity is gone.

This adds an `allow_dismissal` flag to `RemoteServerProjects` that
blocks accidental dismissal (backdrop clicks, focus loss) while a dev
container is being created, but allows explicit dismissal on success or
error.

## How to Review

Small PR — two files changed:

1. **`remote_servers.rs`** (the fix): `allow_dismissal` bool field
added, set to `false` when entering Creating state, set to `true` before
emitting `DismissEvent` on success/error. `on_before_dismiss` override
checks the flag.
2. **`recent_projects.rs`** (the test): Regression test that opens a dev
container modal, simulates a backdrop click, and asserts the modal stays
open.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed dev container creation modal being dismissed when clicking
outside it

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 10:16:45 -07:00
Danilo Leal
9eab76d0a0
sidebar: Adjust "Add Local Project" button behavior (#53248)
This PR makes it so using that button from the sidebar's recent projects
picker _does not_ add a new window with that project, but rather, add it
to the current multi-workspace/sidebar. Previously, the `Open` action
was defaulting to true even if `false` was passed to its
`create_new_window` condition.

Release Notes:

- N/A
2026-04-06 13:47:54 -03:00
Eric Holk
45d6a9595f
Track project groups in MultiWorkspace (#53032)
This PR adds tracking of project groups to the MultiWorkspace and
serialization/restoration of them. This will later be used by the
sidebar to provide reliable reloading of threads across Zed reloads.

Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2026-04-03 16:23:52 +00:00
Toni Alatalo
dc3f5b9972
cli: Add --dev-container flag to open project in dev container (#51175)
## Before you mark this PR as ready for review, make sure that you have:

- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

## Summary

Adds a `--dev-container` CLI flag that automatically triggers "Reopen in
Dev Container" when a `.devcontainer/` configuration is found in the
project directory.

```sh
zed --dev-container /path/to/project
```

## Motivation

This enables fully scripted dev container workflows — for example,
creating a git worktree and immediately opening it in a dev container
without any manual UI interaction:

```sh
git worktree add ../feature-branch
zed --dev-container ../feature-branch
```

The dev container modal fires automatically once the workspace finishes
initializing, so the environment is ready by the time you look at the
window. This is useful for automation scripts that prepare environments
and kick off agent runs for tasks like bug report triage.

Here's an [example
script](https://github.com/antont/todo-rs-ts/blob/main/scripts/devcontainer-new.sh)
that creates a worktree and opens it as a dev container in one step.

Related: #48682 requests a `devcontainer://` protocol for connecting to
already-running dev containers — a complementary but different use case.
This PR covers the "open project and trigger dev container setup" path.

## How it works

- The `--dev-container` flag flows through the CLI IPC protocol to the
workspace as an `open_in_dev_container` option.
- On the first worktree scan completion, if devcontainer configs are
detected, the dev container modal opens automatically.
- If no `.devcontainer/` config is found, the flag is cleared and a
warning is logged.

## Notable changes

- **`Workspace::worktree_scans_complete`** promoted from `#[cfg(test)]`
to production. It was only test-gated because it had no production
callers — it's a pure read-only future with no side effects.
- **`suggest_on_worktree_updated`** now takes `&mut Workspace` to read
and clear the CLI flag.
- Extracted **`open_dev_container_modal`** helper shared between the CLI
code path and the suggest notification.

## Test plan

- [x] `cargo test -p zed open_listener` — includes
`test_dev_container_flag_opens_modal` and
`test_dev_container_flag_cleared_without_config`
- [x] `cargo test -p recent_projects` — existing suggest tests still
pass
- [x] Manual: `cargo run -- --dev-container
/path/to/project-with-devcontainer` opens the modal

Release Notes:

- Added `--dev-container` CLI flag to automatically open a project in a
dev container when `.devcontainer/` configuration is present.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 10:20:49 -07:00
Danilo Leal
34b8d589fa
sidebar: Add button to open the remote projects modal in projects picker (#52932)
This PR adds a button in the sidebar's recent projects picker to open
the remote projects modal, matching how the recent project modal itself
is. Here's the result:

<img width="400" height="428" alt="Screenshot 2026-04-01 at 7  12@2x"
src="https://github.com/user-attachments/assets/b23ff896-6d42-4ea7-92ba-9d3d092c5f03"
/>

Release Notes:

- N/A
2026-04-01 19:28:51 -03:00
Danilo Leal
b3179a1e5a
recent_projects: Improve keyboard navigation (#52866)
Previously, within the recent projects modal, the ability to add a
project to the workspace, delete a project from the "this window" or
"recent projects" sections, and remove a project from the current window
were only possible to do with the mouse. This PR enables them with the
keyboard, through buttons/keybindings exposed in the modal's footer and
"actions" menu. Here's a quick video for reference:


https://github.com/user-attachments/assets/b8980ed8-ba32-4e20-93b4-c0a9ea311309

Release Notes:

- Improved keyboard navigation for the recent projects modal.
2026-04-01 17:08:25 -03:00
KyleBarton
3eadd41b5d
Dev containers native implementation (#52338)
## Context

Closes #11473

In-house Zed implementation of devcontainers. Replaces the dependency on
the [reference implementation](https://github.com/devcontainers/cli) via
Node.

This enables additional features with this implementation:
1. Zed extensions can be specified in the `customizations` block, via
this syntax in `devcontainer.json:
```
...
  "customizations": {
    "zed": {
      "extensions": ["vue", "ruby"],
    },
  },

```
2.
[forwardPorts](https://containers.dev/implementors/json_reference/#general-properties)
are supported for multiple ports proxied to the host

## How to Review

<!-- Help reviewers focus their attention:
- For small PRs: note what to focus on (e.g., "error handling in
foo.rs")
- For large PRs (>400 LOC): provide a guided tour — numbered list of
files/commits to read in order. (The `large-pr` label is applied
automatically.)
     - See the review process guidelines for comment conventions -->

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Improved devcontainer implementation by moving initialization and
creation in-house
2026-04-01 08:16:27 -07:00
Danilo Leal
22c123868a
ui: Improve the end_hover method API in the ListItem component (#52862)
This PR changes the API for the `ListItem`'s `end_hover` slot so that
whatever is in there is always part of the flex stack, as opposed to an
absolutely-positioned element. Additionally, I'm also improving the API
for swapping content between the default state and the hovered state
(e.g., list items where by default we render X, but when you hover, we
show something else). Lastly, I'm adding buttons to some Git picker
items that were only previously available through modal footer buttons.

Release Notes:

- N/A
2026-03-31 21:23:42 -03:00
Mikayla Maki
807207e27f
Own the workspace list in MultiWorkspace (#52546)
## Context

TODO

## Self-Review Checklist

<!-- Check before requesting review: -->
- [ ] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-03-30 22:06:53 +00:00
Mikayla Maki
8cdae31758
Strong app state (#52602)
This PR upgrades the workspace's app state to a strong pointer. It's an
app-global concern, and it should only die when the app dies. When the
app dies the process exits, so the cyclic reference problem isn't an
issue.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-03-27 14:56:46 -07:00
Danilo Leal
2d62837877
sidebar: Ensure the projects menu is dismissed (#52494) 2026-03-26 18:37:28 +00:00
Danilo Leal
e126857732
sidebar: Add another round of refinements (#52101)
- Change the branch button's tooltip to be more accurate given it
displays more stuff than only branches
- Hide the worktree dropdown menu when in a non-Git repo project
- Improve provisioned title truncation
- Remove the plus icon from the "view more" item to improve sidebar's
overall feel
- Remove the always visible "new thread" button but make it visible only
when you're in an empty thread state
- Add worktree icon in the thread item and tooltip with full path
- Space out the worktree name from the branch name in the git picker in
the title bar
- Swap order of views in the git picker to "worktree | branches | stash"
- Improve the "creating worktree" loading indicator

---
<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-03-21 16:22:32 -03:00
Danilo Leal
690d5af735
sidebar: Add several refinements (#51980)
## Context

- Improve how we detect when the sidebar should render the empty state.
It was previously wrong using `content.entries.is_empty`, which would
also happen if there are no search matches.
- Improved archive view keyboard nav and design. Not using the ListItem
here anymore so as to avoid confusing hover and active states.
- Move archive and open folder buttons to the bottom of the sidebar.
- Add a new flavor of the recent projects for the sidebar that only
serves as a way to _add_ projects.
- Add the ability to add (and remove) folders to a given project group
in the sidebar through a dropdown menu
--- 
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-03-19 22:11:22 -03:00
Caio Raphael
806a72c540
title_bar: Prefer most specific repository for nested git repos (#51898)
## Context

I have a project with a nested git repo inside a parent repo (separate
`.git` directory, not a submodule). The title bar shows the parent's
branch instead of the nested repo's own branch.

The issue is in `get_repository_for_worktree()` — it iterates
`git_store.repositories()` (an `FxHashMap`) and returns the first
`starts_with` match. Both the parent and nested repo match, and
whichever one FxHashMap iterates first wins. There's no reason it should
be one or the other.

The fix already exists elsewhere in the codebase —
`GitStore::repository_and_path_for_project_path()` at
`git_store.rs:1826` uses `.max_by_key()` to pick the most specific
(longest path) match. This PR applies the same approach to three
functions that have the same problem:

- `TitleBar::get_repository_for_worktree()` — branch display in title
bar
- `resolve_active_repository()` in `git_ui` — repository selection for
the git panel
- `get_branch_for_worktree()` in `recent_projects` — branch display in
the project switcher

Two other locations use a similar `starts_with` pattern
(`effective_active_worktree()` in `title_bar.rs` and worktree selection
in `recent_projects.rs`) but those iterate worktrees against a single
known repo, not repos against a worktree — so first-match and
longest-match give the same result. Left those unchanged.

Closes #7566

## How to Review

All three changes are the same transformation: first-match loop (or
`.find()`) → `.filter().max_by_key()` on path length. The reference is
at `crates/project/src/git_store.rs:1826`.

The primary fix is `get_repository_for_worktree()` in `title_bar.rs`.
The other two are the same pattern.

One difference from the reference: I used `.as_os_str().len()` instead
of `.clone()` for the `max_by_key` key — avoids cloning an `Arc<Path>`
per comparison. Among prefix-related paths (which is all that passes the
filter), the longer path is always the more specific match, so length
comparison is equivalent.

`title_bar` has no existing test infrastructure. Happy to add a test if
you'd like — the setup would follow the pattern in
`test_git_traversal_with_nested_repos`
(`crates/project/tests/integration/git_store.rs`).

```
cargo test -p title_bar -p git_ui -p recent_projects
./script/clippy
```

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed branch picker showing parent repository's branch instead of the
nested repository's branch when working in submodules or nested git
repos.

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-03-19 15:52:12 +00:00
Danilo Leal
d934ba6cea
sidebar: Add some small design tweaks (#51936)
- [x] I've reviewed my own diff for quality, security, and reliability
- [X] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-03-19 11:15:24 -03:00
Danilo Leal
54ebf32062
sidebar: Add another round of UX refinements (#51884) 2026-03-18 23:04:54 -03:00