Commit graph

36584 commits

Author SHA1 Message Date
Anthony Eid
6837c8aa6b
git_graph: Fix empty search case (#52845)
This fixes a bug where search would match all commits if there was an empty query instead of setting the query to None

Self-Review Checklist:

- [ ] 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

Closes #ISSUE

Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
2026-04-01 00:20:24 +00:00
Mikayla Maki
20b140664d
Fix markdown table rendering in the agent panel (#52864)
This PR reverts part of
https://github.com/zed-industries/zed/pull/50839, as it was causing bad
clipping in the agent panel

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-01 00:10:29 +00:00
Eric Holk
a12601f863
workspace: Break workspace tests into their own file (#52854)
Splits the tests out of `multi_workspace.rs` into a dedicated
`multi_workspace_tests.rs` file for better organization.

Release Notes:

- N/A

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-03-31 23:23:21 +00:00
Danilo Leal
ca7de0fc58
sidebar: Add design adjustments to the thread import feature (#52858)
- Adds a new icon for thread import
- Iterate on the design to access the import modal: it's now through a
button in the sidebar's footer, which only appears when the archive view
is toggled
- Fixed an issue where clicking on checkboxes within the import modal's
list items wouldn't do anything

Release Notes:

- N/A
2026-03-31 19:29:07 -03:00
Andre Roelofs
922b1b5126
worktree: Make expanded symlinks be indexed by default (#51382)
Closes #41887

This is a stable subset of other efforts to make symlink flows more
intuitive like #46344

Release Notes:

- Fixed expanded symlinks not being searchable
2026-03-31 19:33:37 +00:00
Daniel Strobusch
03c5d37972
worktree: Close single-file worktrees when file is deleted (#49366)
When a single-file worktree's root file no longer exists, the background
scanner would previously enter an infinite retry loop attempting to
canonicalize the path. This caused continuous error logging and resource
waste.

This fix detects when a single-file worktree root cannot be
canonicalized (after attempting the file handle fallback) and emits a
new Deleted event, allowing the worktree to be properly closed.

This is most commonly encountered with temporary files, logs, and
similar files that are opened in Zed and then deleted externally, but
persist in the workspace database across sessions.

Closes #34864





## Test
**Logs** from manual testing:

```
2026-02-17T16:16:11+01:00 INFO  [worktree] inserting parent git repo for this worktree: "tmp.md"
2026-02-17T16:16:17+01:00 ERROR [worktree] root path could not be canonicalized: canonicalizing "/Users/***/tmp/tmp.md": No such file or directory (os error 2)
2026-02-17T16:16:17+01:00 INFO  [worktree] single-file worktree root "/Users/***/tmp/tmp.md" no longer exists, marking as deleted
2026-02-17T16:16:17+01:00 INFO  [worktree] worktree root /Users/***/tmp/tmp.md no longer exists, closing worktree
```
Release Notes:

- Fixed an issue where Zed would enter an infinite retry loop when the
backing file for a single-file worktree was deleted
2026-03-31 15:12:32 -04:00
David Alecrim
88d12750fe
command_palette: Fix keymap editor not matching actions with underscored namespaces (#50415)
Closes https://github.com/zed-industries/zed/issues/50223

## Summary

When clicking **Change Keybinding** from the command palette on an
action whose namespace contains underscores (e.g.
`terminal_panel::Toggle`, `project_panel::ToggleFocus`), the keymap
editor showed **"No matches found for the provided query"**. Actions
without underscores (e.g. `zed::OpenLog`) worked fine.

I opened this issue for this
https://github.com/zed-industries/zed/issues/50223, but took the liberty
of sending a PR.

**Root cause:** `normalize_action_query` preserved underscores in the
query, but the search candidates are built with `humanize_action_name`
which converts underscores to spaces. The fuzzy matcher looked for `_`
in a candidate like `"terminal panel: toggle"` where it doesn't exist,
so matching always failed.

**Fix:** `normalize_action_query` now converts underscores to spaces
before the deduplication checks, consistent with `humanize_action_name`.
This also correctly collapses consecutive underscores with adjacent
spaces.

All three call sites of `normalize_action_query` (command palette
search, keymap editor filter, action completion provider) match against
humanized candidates, so the fix improves consistency across all of
them.

## Before (Left) / After (Right)
<img width="2560" height="1053" alt="Screenshot 2026-02-28 at 17 56 05"
src="https://github.com/user-attachments/assets/195530b6-57af-4270-9370-03744cb55e81"
/>
<img width="2557" height="1062" alt="Screenshot 2026-02-28 at 17 55 38"
src="https://github.com/user-attachments/assets/1e8637cd-86c9-496e-bc2b-f9f2d0ac23dc"
/>


Release Notes:

- Fixed keymap editor showing no results when opening "Change
Keybinding" from the command palette for actions with underscores in
their namespace (e.g. `terminal_panel::Toggle`,
`project_panel::ToggleFocus`)
2026-03-31 15:09:16 -04:00
Tim Vermeulen
3a6faf2b4a
editor: Deduplicate sticky header rows (#52844)
Fixes a bug that caused duplicate sticky header rows to appear if
multiple outline items start on the same row.

Sort of addresses #52722, although arguably the real issue there is that
duplicate outline items are being created in the first place.

Before:


https://github.com/user-attachments/assets/7941cbe8-9b62-470c-b475-f08f2f20fac6

After:


https://github.com/user-attachments/assets/c4e291ea-6414-483f-8ff7-3d89d10000b6

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 a bug that caused duplicate sticky header rows to appear if
multiple outline items start on the same row.
2026-03-31 18:56:49 +00:00
Anthony Eid
89732f1279
git: Forbid main git worktree deletion from worktree picker (#52841)
This operation would always fail in the UI because the git binary
already disallowed it. This PR just makes the UI more inline with what's
actually valid

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:

- git: Forbid main git worktree deletion from git worktree picker

---------

Co-authored-by: Eric Holk <eric@zed.dev>
2026-03-31 18:15:39 +00:00
Eric Holk
bf79e32622
Scroll to bottom when reloading ACP agent threads (#52843)
When reopening an ACP agent thread (e.g. after restarting Zed) that has
no saved scroll position, the conversation now starts scrolled to the
bottom so the user sees the latest messages instead of starting at the
top.

Uses `set_follow_tail(true)` rather than a one-shot `scroll_to_end()` so
the scroll position is re-anchored on every layout pass — ensuring it
lands at the true bottom even when list items haven't been measured yet.
The follow-tail mode automatically disengages as soon as the user
scrolls up.

Release Notes:

- Fixed agent threads starting scrolled to the top when reopened after
restarting Zed.
2026-03-31 11:01:05 -07:00
Remco Smits
7455021afc
git_graph: Allow having multiple git graphs open for different repositories (#50401)
Before this PR you could only have the git graph open for the active
repository, this PR changes that.
So you can have 1 git graph open per repository, allowing you to open
multiple different graph at the same time.

**Example**:


https://github.com/user-attachments/assets/9775108f-826a-476f-95de-46abcc1777a6

**Example Persistence**


https://github.com/user-attachments/assets/dbcf6692-7a67-46d9-a7ae-43a7c9a35818

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)

cc @Anthony-Eid I removed the switch repo test since it's no longer a
thing.

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2026-03-31 17:57:53 +00:00
Shiven Garia
56104fb17e
edit_prediction: Fix special token check matching ======= inside comments (#52510)
Closes #52489

The special token check in `prompt_input_contains_special_tokens` used
`String::contains()` to look for `=======\n` in the buffer. This meant
any line containing `=======` (like `// =======` section separators)
would cause edit predictions to bail out entirely.

Fixed by only matching when the token appears at the start of a line,
since the git merge markers are always placed at line boundaries in the
prompt.

Added tests for both the helper function and a regression test for the
reported issue.

---------

Co-authored-by: Oleksiy Syvokon <oleksiy.syvokon@gmail.com>
2026-03-31 20:50:49 +03:00
Bennet Bo Fenner
3ed687d147
sidebar: Fix double borrow on startup (#52834)
```
thread 'main' (35618165) panicked at crates/gpui/src/app/entity_map.rs:164:32:
cannot read workspace::multi_workspace::MultiWorkspace while it is already being updated
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/std/src/panicking.rs:689:5
   1: core::panicking::panic_fmt
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/core/src/panicking.rs:80:14
   2: gpui::app::entity_map::double_lease_panic::<workspace::multi_workspace::MultiWorkspace>
             at ./crates/gpui/src/app/entity_map.rs:208:5
   3: <gpui::app::entity_map::EntityMap>::read::<workspace::multi_workspace::MultiWorkspace>::{closure#1}
             at ./crates/gpui/src/app/entity_map.rs:164:32
   4: <core::option::Option<&workspace::multi_workspace::MultiWorkspace>>::unwrap_or_else::<<gpui::app::entity_map::EntityMap>::read<workspace::multi_workspace::MultiWorkspace>::{closure#1}>
             at /Users/bebo/.rustup/toolchains/1.94.1-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:1067:21
   5: <gpui::app::entity_map::EntityMap>::read::<workspace::multi_workspace::MultiWorkspace>
             at ./crates/gpui/src/app/entity_map.rs:164:14
   6: <gpui::app::entity_map::Entity<workspace::multi_workspace::MultiWorkspace>>::read
             at ./crates/gpui/src/app/entity_map.rs:465:21
   7: <sidebar::Sidebar>::show_archive::{closure#0}
             at ./crates/sidebar/src/sidebar.rs:3462:15
   8: <core::option::Option<gpui::app::entity_map::Entity<workspace::multi_workspace::MultiWorkspace>>>::and_then::<gpui::app::entity_map::Entity<workspace::Workspace>, <sidebar::Sidebar>::show_archive::{closure#0}>
             at /Users/bebo/.rustup/toolchains/1.94.1-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:1546:24
   9: <sidebar::Sidebar>::show_archive
             at ./crates/sidebar/src/sidebar.rs:3461:69
  10: <sidebar::Sidebar as workspace::multi_workspace::Sidebar>::restore_serialized_state
             at ./crates/sidebar/src/sidebar.rs:3606:22
  11: <gpui::app::entity_map::Entity<sidebar::Sidebar> as workspace::multi_workspace::SidebarHandle>::restore_serialized_state::{closure#0}
             at ./crates/workspace/src/multi_workspace.rs:216:18
  12: <gpui::app::App as gpui::AppContext>::update_entity::<sidebar::Sidebar, (), <gpui::app::entity_map::Entity<sidebar::Sidebar> as workspace::multi_workspace::SidebarHandle>::restore_serialized_state::{closure#0}>::{closure#0}
             at ./crates/gpui/src/app.rs:2397:26
  13: <gpui::app::App>::update::<(), <gpui::app::App as gpui::AppContext>::update_entity<sidebar::Sidebar, (), <gpui::app::entity_map::Entity<sidebar::Sidebar> as workspace::multi_workspace::SidebarHandle>::restore_serialized_state::{closure#0}>::{closure#0}>
             at ./crates/gpui/src/app.rs:886:22
  14: <gpui::app::App as gpui::AppContext>::update_entity::<sidebar::Sidebar, (), <gpui::app::entity_map::Entity<sidebar::Sidebar> as workspace::multi_workspace::SidebarHandle>::restore_serialized_state::{closure#0}>
             at ./crates/gpui/src/app.rs:2395:14
  15: <gpui::app::entity_map::Entity<sidebar::Sidebar>>::update::<(), gpui::app::App, <gpui::app::entity_map::Entity<sidebar::Sidebar> as workspace::multi_workspace::SidebarHandle>::restore_serialized_state::{closure#0}>
             at ./crates/gpui/src/app/entity_map.rs:481:12
  16: <gpui::app::entity_map::Entity<sidebar::Sidebar> as workspace::multi_workspace::SidebarHandle>::restore_serialized_state
             at ./crates/workspace/src/multi_workspace.rs:215:14
  17: workspace::restore_multiworkspace::{closure#0}::{closure#7}
             at ./crates/workspace/src/workspace.rs:8712:29
  18: <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update::<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}::{closure#1}
             at ./crates/gpui/src/window.rs:5318:43
  19: <gpui::app::App as gpui::AppContext>::update_entity::<workspace::multi_workspace::MultiWorkspace, (), <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}::{closure#1}>::{closure#0}
             at ./crates/gpui/src/app.rs:2397:26
  20: <gpui::app::App>::update::<(), <gpui::app::App as gpui::AppContext>::update_entity<workspace::multi_workspace::MultiWorkspace, (), <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}::{closure#1}>::{closure#0}>
             at ./crates/gpui/src/app.rs:886:22
  21: <gpui::app::App as gpui::AppContext>::update_entity::<workspace::multi_workspace::MultiWorkspace, (), <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}::{closure#1}>
             at ./crates/gpui/src/app.rs:2395:14
  22: <gpui::app::entity_map::Entity<workspace::multi_workspace::MultiWorkspace>>::update::<(), gpui::app::App, <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}::{closure#1}>
             at ./crates/gpui/src/app/entity_map.rs:481:12
  23: <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update::<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}
             at ./crates/gpui/src/window.rs:5318:21
  24: <gpui::app::App>::update_window_id::<core::result::Result<(), anyhow::Error>, <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}>::{closure#0}
             at ./crates/gpui/src/app.rs:1561:26
  25: <gpui::app::App>::update::<core::option::Option<core::result::Result<(), anyhow::Error>>, <gpui::app::App>::update_window_id<core::result::Result<(), anyhow::Error>, <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}>::{closure#0}>
             at ./crates/gpui/src/app.rs:886:22
  26: <gpui::app::App>::update_window_id::<core::result::Result<(), anyhow::Error>, <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}>
             at ./crates/gpui/src/app.rs:1555:14
  27: <gpui::app::App as gpui::AppContext>::update_window::<core::result::Result<(), anyhow::Error>, <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}>
             at ./crates/gpui/src/app.rs:2425:14
  28: <gpui::app::async_context::AsyncApp as gpui::AppContext>::update_window::<core::result::Result<(), anyhow::Error>, <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>::{closure#0}>
             at ./crates/gpui/src/app/async_context.rs:94:14
  29: <gpui:🪟:WindowHandle<workspace::multi_workspace::MultiWorkspace>>::update::<gpui::app::async_context::AsyncApp, (), workspace::restore_multiworkspace::{closure#0}::{closure#7}>
             at ./crates/gpui/src/window.rs:5313:12
  30: workspace::restore_multiworkspace::{closure#0}
             at ./crates/workspace/src/workspace.rs:8710:14
  31: zed::restore_or_create_workspace::{closure#0}
             at ./crates/zed/src/main.rs:1358:82
  32: zed::main::{closure#10}::{closure#16}::{closure#0}::<i32>
             at ./crates/zed/src/main.rs:877:84
  33: <gpui::app::App>::spawn::<zed::main::{closure#10}::{closure#16}, ()>::{closure#0}
             at ./crates/gpui/src/app.rs:1633:44
  34: <core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = ()>>> as core::future::future::Future>::poll
             at /Users/bebo/.rustup/toolchains/1.94.1-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:133:9
  35: <core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = ()>>> as core::future::future::Future>::poll
             at /Users/bebo/.rustup/toolchains/1.94.1-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:133:9
  36: <scheduler::executor::spawn_local_with_source_location::Checked<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = ()>>>> as core::future::future::Future>::poll
             at ./crates/scheduler/src/executor.rs:361:64
  37: <async_task::raw::RawTask<scheduler::executor::spawn_local_with_source_location::Checked<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = ()>>>>, (), <scheduler::executor::ForegroundExecutor>::spawn<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = ()>>>>::{closure#0}, scheduler::RunnableMeta>>::run
             at /Users/bebo/.cargo/git/checkouts/async-task-e468f817236eac43/b4486cd/src/raw.rs:296:17
  38: <async_task::runnable::Runnable<scheduler::RunnableMeta>>::run
             at /Users/bebo/.cargo/git/checkouts/async-task-e468f817236eac43/b4486cd/src/runnable.rs:788:18
  39: gpui_macos::dispatcher::trampoline
             at ./crates/gpui_macos/src/dispatcher.rs:197:14
  40: <unknown>
  41: <unknown>
  42: <unknown>
  43: <unknown>
  44: <unknown>
  45: <unknown>
  46: <unknown>
  47: <unknown>
  48: <unknown>
  49: <unknown>
  50: <unknown>
  51: <unknown>
  52: <unknown>
  53: <() as objc::message::MessageArguments>::invoke::<()>
             at /Users/bebo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/objc-0.2.7/src/message/mod.rs:128:17
  54: objc::message::platform::send_unverified::<objc::runtime::Object, (), ()>
             at /Users/bebo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/objc-0.2.7/src/message/apple/mod.rs:27:9
  55: objc::message::send_message::<objc::runtime::Object, (), ()>
             at /Users/bebo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/objc-0.2.7/src/message/mod.rs:178:5
  56: <*mut objc::runtime::Object as cocoa::appkit::NSApplication>::run
             at /Users/bebo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cocoa-0.26.0/src/appkit.rs:628:9
  57: <gpui_macos::platform::MacPlatform as gpui::platform::Platform>::run
             at ./crates/gpui_macos/src/platform.rs:488:17
  58: <gpui::app::Application>::run::<zed::main::{closure#10}>
             at ./crates/gpui/src/app.rs:187:18
  59: zed::main
             at ./crates/zed/src/main.rs:456:9
  60: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /Users/bebo/.rustup/toolchains/1.94.1-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace
```

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-31 19:18:15 +02:00
Oleksiy Syvokon
924ac5c99b
gpui_wgpu: Guard against device feature mismatch (#52820)
This should prevent the "wgpu-hal invariant was violated (usage error):
Requested feature is not available on this device" panic, although I'm
not 100% sure (there's a possibility that a device reports the feature
but fails to use it). At the very least, we get more logging

I've tested this fix by patching code to emulate a situation where
device features change after the creation, but that may be not
representative of the real world failure.


Addresses ZED-5G1

Release Notes:

- N/A
2026-03-31 20:08:20 +03:00
Richard Feldman
7cf26f4046
Fix submodules being incorrectly classified as linked worktrees (#52507)
For submodules, `common_dir_abs_path` equals `repository_dir_abs_path`
(since submodules don't have a `commondir` file). The previous code
passed this path to `original_repo_path_from_common_dir`
unconditionally, which returned the `.git/modules/<name>` path as the
`original_repo_abs_path` — causing `linked_worktree_path()` to return a
false positive for submodules.

Now we detect linked worktrees by checking whether `common_dir` differs
from `repository_dir` (only true for actual linked worktrees that have a
`commondir` file). For normal repos and submodules,
`original_repo_abs_path` is simply `work_directory_abs_path`.

Also fixes the misleading doc comment on `common_dir_abs_path` in
`LocalRepositoryEntry` and adds test assertions for
`original_repo_abs_path` and `linked_worktree_path()` on both worktrees
and submodules.

Closes AI-102

Release Notes:

- Fixed git submodules being incorrectly classified as linked worktrees,
which could cause issues with worktree-related operations.
2026-03-31 12:40:01 -04:00
Finn Evers
7123238690
Remove slash-commands-example extension (#52835)
Follow-up to https://github.com/zed-industries/zed/pull/52757

Release Notes:

- N/A
2026-03-31 18:27:38 +02:00
Ben Brandt
76c6004b27
Remove text thread and slash command crates (#52757)
🫡

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:

- Removed legacy Text Threads feature to help streamline the new agentic
workflows in Zed. Thanks to all of you who were enthusiastic Text Thread
users over the years ❤️!

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-03-31 17:55:05 +02:00
Danilo Leal
11efe82a1f
sidebar: Add some design adjustments (#52832)
- Adjust thread item and gradient fade colors for themes that define
transparent colors for the tokens we use on them
- Make the entire project header clickable area activate the workspace
instead of collapsing the group. The chevron is now an icon button that
does that, which makes it consistent with the collab panel and settings
UI.

Release Notes:

- N/A
2026-03-31 12:42:24 -03:00
Derek Parker
f7ab907216
Fix agent servers loading environment from home dir instead of project dir (#52763)
All local agent server types were calling `local_directory_environment`
with `paths::home_dir()`, causing direnv and shell environment to be
loaded from `~` rather than the project's worktree directory. This meant
project-specific `.envrc` variables (e.g. Google Vertex credentials)
were never picked up by external agents like Claude.

Added `default_environment()` on `ProjectEnvironment` that resolves the
default visible worktree path and uses it for environment loading,
falling back to home_dir() only when no worktree is available.

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:

- Fixed default environment variable context for external agents
2026-03-31 15:37:20 +00:00
Richard Feldman
0f173eb8ae
Remove deprecated 1M context beta header for Sonnet 4.5 (#52767)
The `CONTEXT_1M_BETA_HEADER` (`context-1m-2025-08-07`) is deprecated for
Sonnet 4 and 4.5. This removes the constant from the anthropic crate and
the match arm in `beta_headers()` that sent it for
`ClaudeSonnet4_5_1mContext`.

Note: The bedrock crate still has its own copy of this constant, used
when the user-configurable `allow_extended_context` setting is enabled.
That may warrant a separate cleanup.

Closes AI-114

Release Notes:

- N/A
2026-03-31 10:54:52 -04:00
MostlyK
d24480b518
nix: Update flake.lock (#52766)
- update flake.lock with the 1.94.1
- Fixes nix build not working.


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-31 16:14:26 +02:00
Nathan Sobo
121e2bbe84
Extract syntax_theme crate (#52798)
Extract `SyntaxTheme` into its own lightweight crate so that downstream
consumers can use syntax highlighting colors without pulling in the full
`theme` crate and its transitive dependencies.

## Changes

**Commit 1 — Extract SyntaxTheme into its own crate**

Move `SyntaxTheme`, `SyntaxThemeSettings`, `HighlightStyle`, and
supporting types from `theme/src/styles/syntax.rs` into a new
`syntax_theme` crate that depends only on `gpui`. The `theme` crate
re-exports everything for backward compatibility — no call-site changes
needed.

**Commit 2 — Add `bundled-themes` feature with One Dark**

Add an optional `bundled-themes` feature that bundles `one_dark()`, a
`SyntaxTheme` loaded from the existing One Dark JSON theme file. This
lets consumers get a usable syntax theme without depending on the full
theme machinery.

Release Notes:

- N/A
2026-03-31 08:06:37 -06:00
Ben Brandt
8ef64d99d8
agent_ui: Update work dirs for all conversation threads (#52825)
Propagate work directory changes through `ConversationView` instead
of only updating active and generating root threads.

This makes sure that all subagents are in sync, as well as any currently
"active" threads in the agent panel.

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

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-03-31 13:21:38 +00:00
Balamurali Pandranki
ef42f9db2d
gpui_wgpu: Add surface lifecycle methods for mobile platforms (#50815)
## Summary

- Add `unconfigure_surface()` and `replace_surface()` methods to
`WgpuRenderer` for mobile platform window lifecycle management
- Prefer `PresentMode::Mailbox` (triple-buffering) over `Fifo` to avoid
blocking during lifecycle transitions
- Early return in `draw()` when surface is unconfigured to prevent
driver hangs

## Motivation

On Android, the native window (`ANativeWindow`) is destroyed when the
app goes to the background and recreated when it returns to the
foreground. The same happens during orientation changes. Without surface
lifecycle methods, the only option is to destroy the entire
`WgpuRenderer` and create a new one on resume.

The problem: GPUI's scene cache holds `AtlasTextureId` references from
the old renderer's atlas. A new renderer has an empty atlas, so those
cached IDs cause index-out-of-bounds panics.

The fix: Keep the renderer (device, queue, atlas, pipelines) alive
across surface destruction. Only the wgpu `Surface` needs to be
replaced.

### `unconfigure_surface()`
Marks the surface as unconfigured so `draw()` skips rendering via the
existing `surface_configured` guard. Drops intermediate textures that
reference the old surface dimensions. The renderer stays fully alive.

### `replace_surface()`
Creates a new `wgpu::Surface` from fresh window handles using the
**same** `wgpu::Instance` that created the original adapter/device.
Reconfigures the surface and marks it as configured so rendering
resumes. All cached atlas textures remain valid.

### PresentMode::Mailbox
`Fifo` (VSync) blocks in `get_current_texture()` and can deadlock if the
compositor is frozen during a lifecycle transition (e.g.
`TerminateWindow` → `InitWindow` on Android). Mailbox (triple-buffering)
avoids this. Falls back to `AutoNoVsync` → `Fifo` if unsupported.

### draw() early return
Some drivers (notably Adreno) block indefinitely when acquiring a
texture from an unconfigured surface. The early return prevents this.

## Context

This is needed by
[gpui-mobile](https://github.com/itsbalamurali/gpui-mobile), a project
bringing GPUI to Android and iOS. The Android implementation needs these
methods to handle:

1. **Background/foreground transitions** — `TerminateWindow` destroys
the native window, `InitWindow` recreates it
2. **Orientation changes** — Surface is destroyed and recreated with new
dimensions
3. **Split-screen transitions** — Similar surface recreation

Without this change, we maintain a local fork of `gpui_wgpu` with just
these additions. Upstreaming them would let mobile platform
implementations use the official crate directly.

## Test plan

- [x] Tested on Android (Motorola, Adreno 720 GPU) — 3 consecutive
background/foreground cycles, zero panics, atlas textures preserved
- [x] Tested orientation changes (portrait→landscape→portrait) — surface
replacement completed in <40ms per rotation
- [x] Verified `draw()` correctly skips rendering when surface is
unconfigured
- [x] Verified no regression on desktop — methods are additive, existing
code paths unchanged
- [x] PresentMode fallback chain works on devices that don't support
Mailbox

## Release Notes

- N/A
2026-03-31 13:16:53 +00:00
Bennet Bo Fenner
080e80df2b
agent_ui: Prevent race conditions inside thread metadata store (#52819)
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

---------

Co-authored-by: Gaauwe Rombouts <mail@grombouts.nl>
2026-03-31 14:48:33 +02:00
Ben Brandt
809e701163
acp: Notify when we receive new versions from the registry (#52818)
Wires up the missing version notifications for registry + extension
agents.
The UI part of this is already setup, we were just never triggering it.

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

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-03-31 11:49:21 +00:00
Win Cheng
f548125a65
workspace: Allow disabling tab cycles when using keyboard navigation (#51253)
Add a `wrap_around` field, defaulting to `true`, to both
`pane::ActivatePreviousItem` and `pane::ActivateNextItem` actions to
optionally disable wrapping when cycling past the first or last tab.

Release Notes:

- Added a `wrap_around` option to both `pane::ActivatePreviousItem` and
`pane::ActivateNextItem` actions to optionally disable wrapping when
cycling past the first or last tab.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-03-31 11:19:45 +00:00
Danilo Leal
eec3302cbc
ui: Adjust tree view item alignment (#52776)
Adjusting the alignment of things in the tree view item given it got
affected after I took out the square shape from the disclosure button in
https://github.com/zed-industries/zed/pull/52322. Now, the indent line
and the labels are back to being fully aligned.

Release Notes:

- N/A
2026-03-31 07:21:18 -03:00
Danilo Leal
9526861bee
sidebar: Adjust thread switcher modal (#52788)
This PR makes use of the `ThreadItem` component for the thread switcher,
as opposed to recreating it locally. Added some additional methods to it
so as to nicely fit in the switcher modal. Am also rendering the project
name, given that it felt like a major piece of context, given that
without the sidebar open, you'd potentially feel a bit lost without it.

Release Notes:

- N/A
2026-03-31 07:21:10 -03:00
Pratik Karki
b7f166ab40
Fix FormatSelections to only format selected ranges, not entire document (#51593)
When `editor: format selections` get invoked, the Prettier and external
formatter branches in `format_buffer_locally` ignored the selection
ranges entirely, causing the whole document to be formatted.

- Thread selection ranges as UTF-16 offsets through to Prettier via
`rangeStart/rangeEnd` options in the format request.
- Skip external formatters when ranges are present, since they have no
mechanism for range formatting.
- Create diff edits and apply them for JSON-like languages. For
single-expression languages like JSON, it wasn't respecting the range
commands from Prettier. So, filter the diff edits returned by Prettier
to retain only those overlapping with the user's selection byte ranges,
ensuring changes outside the selection are never applied.

Part of #25796 

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)

Release Notes:

- Fixed FormatSelections to only format selected ranges, not the entire
document where prettier is supported.

Current Behaviour:

[original
behaviour.webm](https://github.com/user-attachments/assets/d5f0cb48-4c3f-44aa-89a9-975f31fce92d)

New Behaviour:

[new
behaviour.webm](https://github.com/user-attachments/assets/41e04b90-f37f-43e1-b8ed-4622684454b1)

---------

Signed-off-by: Pratik Karki <pratik@prertik.com>
2026-03-31 12:48:22 +03:00
Bennet Bo Fenner
bc2d08caa9
sidebar: Unarchive 5 most recent threads when migrating (#52807)
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-31 11:06:35 +02:00
William Desportes
65e445acd3
languages: Mark .json.dist as a JSON file (#52473)
## Context

<!-- What does this PR do, and why? How is it expected to impact users?
     Not just what changed, but what motivated it and why this approach.

Link to Linear issue (e.g., ENG-123) or GitHub issue (e.g., Closes #456)
     if one exists — helps with traceability. -->

## 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
- [ ] 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:

- Marked `.json.dist` as a `json` file
2026-03-31 08:55:31 +00:00
William Desportes
55fa8758d1
languages: Mark .jshintrc as a JSONC file (#52474)
## Context

<!-- What does this PR do, and why? How is it expected to impact users?
     Not just what changed, but what motivated it and why this approach.

Link to Linear issue (e.g., ENG-123) or GitHub issue (e.g., Closes #456)
     if one exists — helps with traceability. -->

## 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
- [ ] 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:

- Marked `.jshintrc` as a `jsonc` file
2026-03-31 08:54:59 +00:00
Ian Chamberlain
361428a450
editor: Limit CopyHighlightJson to selection (#46555)
Closes https://github.com/zed-industries/zed/issues/36618

I'm not sure if there is a specific issue for this, but I noticed it
while working on some other PRs, as have some other people:
https://github.com/zed-industries/zed/issues/20525#issuecomment-2469507157

Cause: when running `copy highlight JSON` from the command palette,
input was disabled due to the modal, and the selection method call
always returns `None`. This most likely works as expected when bound to
a keyboard shortcut, but since there is no default shortcut most people
probably don't execute this action that way.

Fix: just grab the selection directly; I don't think this command needs
to be IME-aware, so it doesn't need to use `selected_text_range`.

NOTE: There still seems to be an issue where `VISUAL LINE` mode doesn't
select anything, even when I called `selections.newest_adjusted`, so I
opted to try and keep the implementation closest to what it was doing
before. (edit: actually this might just be the same as #45799?).

Release Notes:

- Fixed `editor: copy highlight JSON` not limiting to the current
selection
2026-03-31 08:39:44 +00:00
Danilo Leal
ebb451ec7b
agent_ui: Improve onboarding to the import threads feature (#52748)
Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-03-31 09:10:56 +02:00
saberoueslati
6a95e29387
git_panel: Fix space key being swallowed in branch picker (#52779)
## Context

Fixes a regression where typing a space in the Git Panel's "Switch
Branch" picker would make no response at all instead of inserting the
character. The same picker in the title-bar Git Switcher was unaffected.

Root cause: `PopoverMenu` links the opened menu's focus handle into the
parent element's dispatch tree so that `contains_focused` returns `true`
on the parent while the popover is open. `GitPanel::dispatch_context`
uses
`contains_focused` to decide whether to add the `ChangesList` key
context, so that context is active while the branch picker is open.
Because `Picker` and `Editor` have no binding for a bare `space`,
dispatch fell through to
the `"GitPanel && ChangesList"` binding, which maps `space` to
`git::ToggleStaged`, consuming the keystroke before it could reach the
text input.

The fix narrows the context guard to `"GitPanel && ChangesList &&
!GitBranchSelector"`,
so those bindings are skipped whenever the branch picker (or any other
`GitBranchSelector` context) is focused inside the panel.

The same change is applied to the vim keymap, which would have similarly
intercepted `k`,
`j`, `x`, and other letter keys typed in the picker, this behavior was
observed in https://github.com/zed-industries/zed/issues/52617 and I
made the same fix in https://github.com/zed-industries/zed/pull/52687

Closes #52771 and potentially
https://github.com/zed-industries/zed/issues/52617

Video of the manual test of the fix below :

[Screencast from 2026-03-31
00-01-54.webm](https://github.com/user-attachments/assets/76f64507-4f5a-4a8e-8582-4cdb9bec584c)

## How to Review

- `assets/keymaps/default-linux.json`, `default-windows.json`,
`default-macos.json`, `vim.json` : identical one-line change in each: I
added `&& !GitBranchSelector` to
  the `"GitPanel && ChangesList"` 
. No Rust changes needed.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed space and other keys being swallowed when typing in the Git
Panel branch picker
2026-03-30 23:56:37 -07:00
saberoueslati
7315aada89
git_ui: Fix branch picker stealing vim keys in Git panel (#52687)
## Context

When `vim_mode` is enabled, opening the branch selector popover in the
Git panel and pressing `i`, `j`, `k`, or `x` triggered Git panel actions
(`FocusEditor`, `SelectNext`, `ToggleStaged`, etc.) instead of reaching
the picker's search field.

The `"GitPanel && ChangesList"` keybinding block in `vim.json` matched
whenever _any_ child of the git panel's focus handle was focused —
including the branch picker popover — because
`GitPanel::dispatch_context()` adds `ChangesList` based on
`focus_handle.contains_focused()`, which is true for all children, not
just the changes list itself.

The branch picker's root element already sets
`.key_context("GitBranchSelector")` (branch_picker.rs). GPUI's `Not`
predicate evaluates against the entire context path, so adding `&&
!GitBranchSelector` to the block's context suppresses all those bindings
whenever the picker is open, and restores them exactly as before once
it's closed.

Closes #52617

Video of the manual test of the fix below :

[Screencast from 2026-03-29
22-01-11.webm](https://github.com/user-attachments/assets/217e8e31-9bee-4e77-a7aa-0c094874ed9a)

## How to Review

- `assets/keymaps/vim.json` : changed the `"GitPanel && ChangesList"`
context string ,I added`&& !GitBranchSelector`.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed branch picker in the Git panel stealing vim keystrokes (`i`,
`j`, `k`, `x`) when vim mode is enabled
2026-03-30 23:28:13 -07:00
Mikayla Maki
d22a39f84d
Hide other panels when clicking on sidebar threads (#52804)
This PR makes it so that clicking on sidebar threads behaves the same as
the "focus agent panel" keybinding, namely it hides zoomed panels and
brings focus to the agent panel.

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-31 06:25:03 +00:00
Max Brunsfeld
24613f5456
Fix resizing bottom-docked terminal panel (#52803)
The terminal panel is now flexible by default, but only when in a left
or right panel. This PR fixes a bug where resizing the terminal panel
was incorrectly setting the flex value instead of the fixed size when
the terminal panel was in the bottom dock and flexible.

Release Notes:

- N/A
2026-03-31 06:20:11 +00:00
Smit Barmase
3e0a0e1dd5
markdown: Skip linkify inside code blocks (#52762)
Profiling streamed agent responses showed `parse_markdown_with_options`
consuming ~50% of CPU cycles. The hot path is `LinkFinder` scanning
every `Text` event, including code block content, where detected URLs
are never rendered as links.

In the profiled case, the markdown had 235k+ URLs inside code blocks,
making linkify extremely costly per-parse. This PR short-circuits the
text-merging + linkify path for code block content.

Release Notes:

- N/A
2026-03-31 11:24:25 +05:30
Yifan Ruan
0857b41b15
docs: Update guide to remove user data on macOS when uninstalling Zed (#52631)
I recently encountered some issue on my mac and I tried to uninstall Zed
completely. However the current guide to remove user data does not cover
some configs that Zed uses. There are also some directories that should
be removed according to the doc but never exist. So I have this pull
request to make the user data directories more accurate, according to my
own experience.

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: doc update

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-03-31 05:35:04 +00:00
Mikayla Maki
7719d2978f
Simplify sidebar active state (#52799)
This changes the terminology from "focused entry" to "active entry", and
adds 4 properties that rebuild_contents should maintain for the active
entry:

- We should always have an active_entry after rebuild_contents
- The active entry's workspace should always be == to the active
multiworkspace
- If there's a thread, the active entry should always reflect that
thread
- There should always be exactly 1 active entry

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-03-31 04:53:34 +00:00
Mikayla Maki
2e44664ab8
Implement sidebar serialization (#52795)
This PR implements basic sidebar deserialization. When the
multiworkspace decides to save itself, it causes the sidebar to
serialize as well. The sidebar can trigger this as well via an event.

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-31 04:16:35 +00:00
Mikayla Maki
f3e672c09a
Implement work dir updating for active and background threads (#52793)
This PR changes things so that when the user mutates their current
project (e.g. adding a folder), the thread entries now update the
currently running threads to be pointing at this new set of folders.

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

TODO:
- [x] Manually test this case

Release Notes:

- N/A
2026-03-31 03:11:04 +00:00
Mikayla Maki
dfafd62afc
Implement non-macos titlebars for the new sidebar (#52794)
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


Icons aren't showing because I'm forcing the UI to be visible on macOS,
but things look ok on the right sidebar:

<img width="389" height="955" alt="Screenshot 2026-03-30 at 7 36 06 PM"
src="https://github.com/user-attachments/assets/269fe9c9-1212-4c1e-b8d9-1694db70adf3"
/>


Release Notes:

- N/A
2026-03-31 02:46:07 +00:00
Max Brunsfeld
fb87786375
Automatically switch to unified diffs when diff view is narrower than a configurable "minimum split diff width" (#52781)
Release Notes:

- The git diff diff view now automatically switches from split mode to
unified mode when the pane is narrower than a configurable minimum
column count. You can configure this via the new
`minimum_split_diff_width` setting.
2026-03-30 18:47:50 -07:00
Mikayla Maki
e39d5c9908
Remove easily derived sidebar state (#52790)
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-03-31 01:46:08 +00:00
Mikayla Maki
8b0d49f474
Add existing user agent onboarding flow (#52787)
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-03-31 01:39:47 +00:00
Eric Holk
3d29a0641e
sidebar: Add debug action to dump multi-workspace state (#52785)
Add a debug-only (`cfg(debug_assertions)`) action `DumpWorkspaceInfo`
that opens a read-only buffer with a dump of all workspace state. This
is useful for debugging the sidebar's view of workspaces and threads,
since the sidebar is currently the only way to see workspace-related
state.

For each workspace in the MultiWorkspace it shows:

- **Workspace DB ID** — for cross-referencing with persistence
- **All worktrees** with their paths, branches, and visibility
- **Whether each worktree is a git linked worktree** and where it links
to
- **Active agent thread** with title, session ID, status, and entry
count
- **Background agent threads** with the same detail
- **A warning** if the agent panel's workspace ID doesn't match the
workspace

Example output:
```
MultiWorkspace: 3 workspace(s)
Active workspace index: 1

--- Workspace 0 ---
Workspace DB ID: WorkspaceId(42)
Worktrees:
  - /Users/eric/repo/scratch3 [branch: refs/heads/scratch3] [linked worktree -> /Users/eric/repo/scratch]
Active thread: Git Worktree Path Consistency Check (session: 575b4349-...) [idle, 42 entries]

--- Workspace 1 (active) ---
Workspace DB ID: WorkspaceId(57)
Worktrees:
  - /Users/eric/repo/worktrees/zed/my-branch/zed [branch: refs/heads/my-branch] [linked worktree -> /Users/eric/repo/zed]
Active thread: Sidebar Not Displaying Git Worktree (session: 8f337c5c-...) [generating, 17 entries, awaiting confirmation]
Background threads (1):
  - Previous Investigation (session: abc12345-...) [idle, 83 entries]

--- Workspace 2 ---
Workspace DB ID: WorkspaceId(63)
Worktrees:
  - /Users/eric/repo/ex [branch: refs/heads/main]
Active thread: (none)
```

### Implementation

The action and handler live in the `sidebar` crate (close to what they
debug), following the same pattern as `language_tools` owning
`OpenLanguageServerLogs` and `debugger_tools` owning
`OpenDebugAdapterLogs`. The `zed` crate has only a one-line
registration.

Two small public accessors were added to `AgentPanel`:
- `workspace_id()` — exposes the panel's workspace ID for mismatch
detection
- `background_threads()` — exposes retained background conversation
views

Release Notes:

- N/A
2026-03-31 00:47:38 +00:00
Eric Holk
c9e45fe829
sidebar: Represent workspaces with no threads as a New Thread entry (#52778)
Workspaces with no threads weren't being shown in the sidebar which can
make it easy to lose your sense of place. This PR works to address that
by showing these workspaces as a "New Thread" button which also shows
the work trees associated with that 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

Release Notes:

- N/A
2026-03-31 00:40:21 +00:00