Commit graph

688 commits

Author SHA1 Message Date
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
Piotr Osiewicz
1b9f3833f0
ui: Follow-up to ui crate teardown (#52747)
- **Remove some of the settings types from ui**
- **drag settings-less ui across the line**

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

---------

Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
2026-03-30 18:04:21 +02:00
Cole Miller
564d1fe938
git: Implement branch diff line counts efficiently (#52582)
Previously we were iterating over all hunks across all diffs on every
frame. Now we can read off the required information as a `SumTree`
summary in constant time.

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: Fixed bad performance in large branch diffs.
2026-03-30 14:23:02 +00:00
Piotr Osiewicz
93e641166d
theme: Split out theme_settings crate (#52569)
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
2026-03-27 14:41:25 +01:00
Anthony Eid
69286d6929
git: Forbid deleting current git worktree or branch from picker (#52327)
## Context

This just makes the UI enforce some git cli rules more clearly and
prevents some unexpected behavior.

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

- N/A
2026-03-27 09:01:01 -04:00
Mikayla Maki
8eb86241f6
Add a setting for moving the sidebar to the right (#52457)
## Context

This adds a setting for controlling the sidebar side

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

- N/A

---------

Co-authored-by: Eric <eric@zed.dev>
2026-03-26 01:35:10 +00:00
Marshall Bowers
72bc4dc534
cloud_llm_client: Move CompletionIntent to language_model (#52359)
This PR moves the `CompletionIntent` enum from the `cloud_llm_client`
crate to the `language_model` crate, as it is no longer part of the
Cloud interface.

Release Notes:

- N/A
2026-03-25 08:39:17 +01:00
Xiaobo Liu
0a4269ffa2
git_ui: Fix Git Graph button flicker in Git panel (#52285)
Release Notes:

- Fixed Git Graph button flicker in Git panel
2026-03-25 06:23:42 +00:00
Max Brunsfeld
aca5209761
Make the agent panel have a flexible width (#52276)
Release Notes:

- The agent panel now has a flexible width, similar to the center panes
of the workspace.
2026-03-24 18:45:43 +00:00
Danilo Leal
f3534fc95c
git_ui: Improve UI for the branch, stash, and worktree pickers (#52274)
## Context

This PR refines the design for all of these Git pickers but making them
look more consistent and polished (using same fonts, dividers, and
alignment). It also adds a delete button to all items in each picker so
you can more intuitively delete each item if you're on a mouse-based
flow.

| Worktrees | Stashes | Branches |
|--------|--------|--------|
| <img width="1490" height="1178" alt="Screenshot 2026-03-23 at 9  15
2@2x"
src="https://github.com/user-attachments/assets/3143a626-1b97-43b5-b769-d6cab2c5df7c"
/> | <img width="1490" height="1178" alt="Screenshot 2026-03-23 at 9  15
3@2x"
src="https://github.com/user-attachments/assets/80cbd5ee-394d-42b7-84f8-2d9950d9889e"
/> | <img width="1490" height="1178" alt="Screenshot 2026-03-23 at 9 
15@2x"
src="https://github.com/user-attachments/assets/408fd12e-fb18-4233-a4bf-5fad53aa307f"
/> |

--- 

- [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-24 11:13:40 -03:00
João Soares
45be23c56c
Fix git panel context menu keybinding jitter (#52217)
Context

The git panel's context menu caused visual jitter (flickering/jumping)
when opened via right-click on a tracked file. The root cause was in
`dispatch_context()`: it used `self.focus_handle == focused` to check if
the panel itself was directly focused, but when a context menu opened,
focus moved to the menu (a child element), causing the `"menu"` and
`"ChangesList"` key contexts to be dropped. This triggered a re-render
with different keybindings, which re-added them, creating a loop of
jitter.

The fix replaces the direct focus equality check with
`self.focus_handle.contains_focused(window, cx)`, which returns `true`
when any child element (including the context menu) holds focus within
the panel's focus tree. This is consistent with how other panels
(project panel, outline panel, collab panel) handle focus-based dispatch
contexts.

Closes #51813

## Demo

**Before fix:**




https://github.com/user-attachments/assets/e18d49b2-72a6-4411-8ec5-519e36628f29


**After fix:**



https://github.com/user-attachments/assets/94c936d2-1e81-4d28-a86a-8b1ed76ddde1



## How to Review

This is a small, focused change in a single file:
`crates/git_ui/src/git_panel.rs`.

1. **The fix** (~line 974): `dispatch_context()` method — the old code
checked direct focus equality (`self.focus_handle == focused`), the new
code uses `self.focus_handle.contains_focused(window, cx)` and
restructures the conditionals so `CommitEditor` is checked first via
`if/else if`.
2. **The test** (~line 7871): `test_dispatch_context_with_focus_states`
— verifies 4 focus state transitions: commit editor focused, changes
list focused, back to commit editor, and back to changes list. Each case
asserts the correct key contexts are present/absent.

## 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](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 git panel context menu jitter caused by keybinding dispatch
context flickering when right-clicking on tracked files (#51813)
2026-03-24 11:52:13 +00:00
Valery Borovsky
ce7cd7c163
git_ui: Hide status icon when status_style is set to label_color (#51947)
## Context

When `git_panel.status_style` is set to `label_color`, the git panel 
should indicate file status through text color only, without showing 
status icons. However, the icons were still being rendered regardless 
of this setting.

The root cause: `git_status_icon(status)` was called unconditionally 
in `render_status_entry`, with no check against the current 
`status_style` value.

Closes #51714

## How to Review

Single change in `crates/git_ui/src/git_panel.rs` — 
`render_status_entry` function. The icon render call is now wrapped 
in `.when(status_style != StatusStyle::LabelColor, ...)`.

Release Notes:

- Fixed git panel status icons still showing when
`git_panel.status_style`
  is set to `label_color`

Bug:
<img width="2559" height="1357" alt="image"
src="https://github.com/user-attachments/assets/3cad9f96-8b5c-4554-8b9f-f931026bdfe1"
/>

Fix:
<img width="1512" height="801" alt="image"
src="https://github.com/user-attachments/assets/99f36d11-a8b2-412a-ab73-18200f6594d2"
/>
2026-03-24 11:51:20 +00:00
Dino
f5e56b5ccb
helix: Add support for line length in reflow command (#52152)
* Add `editor::RewrapOptions::line_length` to, optionally, override the
  line length used when rewrapping text.
* Update `editor::Editor::rewrap_impl` to prefer
  `editor::RewrapOptions::line_length`, when set.
* Add a `line_length` field to the `vim::rewrap::Rewrap` action.
* Update the `:reflow` vim command with `vim::command::VimCommand::args`
  so as to be able to parse the provided argument as `usize`, ensuring
  that no effect is taken if the argument can't be parsed as such.

Release Notes:

- N/A
2026-03-23 11:09:54 +00:00
Om Chillure
b1e8473723
git_ui: Support side-by-side diff view in clipboard selection diff (#51966)
#### Context

Switches `TextDiffView` from using `Editor` directly to
`SplittableEditor`, enabling side-by-side diff view support for "Diff
Clipboard with Selection". The diff view now respects the user's
`diff_view_style` setting.

Split out from #51457. This PR contains only the `SplittableEditor`
wiring. The multibuffer coordinate fix for non-singleton editors will
follow in a separate PR.

Closes #50912 (partially)

#### How to Review

Small PR — all changes are in `crates/git_ui/src/text_diff_view.rs`.
Focus on:
- `new()`: `SplittableEditor::new` replaces `Editor::for_multibuffer`,
editor-specific setup goes through `rhs_editor()`
- Item trait delegation: `act_as_type`, `for_each_project_item`,
`set_nav_history` updated for `SplittableEditor`
- Tests: pinned `DiffViewStyle::Unified` and assertions go through
`rhs_editor()`

#### 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](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

#### Video : 
[Screencast from 2026-03-19
23-11-36.webm](https://github.com/user-attachments/assets/c5a2381d-238d-43ef-ac6f-9994996c0c69)


#### Release Notes:

- Improved "Diff Clipboard with Selection" to support side-by-side diff
view style.
2026-03-23 09:10:18 +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
Lukas Wirth
8f6e93974b
git_ui: Do not show "resolve with agent" as a collab guest (#51676)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-20 16:06:53 +01:00
Om Chillure
2839676b3e
git_ui: Fix multibuffer coordinate conversion in clipboard diff (#51985)
## Context

Fixes the visual selection update in `TextDiffView::open` to properly
convert between buffer-local and multibuffer coordinates using
`buffer_point_to_anchor`. Previously, raw multibuffer Points were used
directly for line expansion, which produced incorrect regions when
expanded deleted diff hunks shifted multibuffer row numbers.

This provides a single unified code path for both singleton and
non-singleton multibuffers, as suggested in [#51457 review
feedback](https://github.com/zed-industries/zed/pull/51457#issuecomment-4091134303).

Follow-up to #51457.

## How to Review

Small PR - all changes are in `crates/git_ui/src/text_diff_view.rs`.
Focus on:

- `open()`: The visual selection update block now uses
`buffer_point_to_anchor` + `to_point` instead of raw multibuffer
coordinate math
- No more assumption that multibuffer Points == buffer-local Points
- Existing tests validate both singleton and non-singleton multibuffer
paths

## Self-Review Checklist
- [x] I've reviewed my own diff for quality, security, and reliability
- [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 incorrect diff region when using "Diff Clipboard with Selection"
with expanded diff hunks in the editor.
2026-03-20 07:30:58 +00:00
Eric Holk
2d7c7200cf
multiworkspace: Don't destroy workspace when git worktree is detached head (#51977)
When a git worktree is in a detached HEAD state (e.g. after `git
checkout --detach`), the workspace for that worktree would disappear
from the sidebar UI, and if the workspace was currently open your UI
would just disappear.

This happened because `parse_worktrees_from_str` silently dropped any
worktree entries without a `branch` line in the porcelain output, which
cascaded through the `linked_worktrees` list and caused
`prune_stale_worktree_workspaces` to remove the workspace.

This PR:
- Makes `Worktree::ref_name` an `Option<SharedString>` so detached
worktrees can be represented
- Renames `Worktree::branch()` to `Worktree::display_name()`, which
returns the branch name when available or the short SHA as a fallback
(mirroring how the title bar already handles detached HEAD for
repositories)
- Updates `parse_worktrees_from_str` to include detached and bare
worktree entries instead of dropping them
- Filters detached worktrees out of the worktree picker UI, preserving
the existing product decision to only show branch-based worktrees there

## 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-19 17:18:08 -07: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
Max Brunsfeld
2cc7d17f34
Fix usability issues with automatically-created git worktrees (#51775)
* [x] Display original project name as root folder in project panel,
titlebar
* [x] When manually creating worktrees, ensure final path component is
original project name
* [x] Display original project name, worktree name, and branch name in
titlebar
* [x] Only show main checkout in project switcher

Release Notes:

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

---------

Co-authored-by: Richard Feldman <oss@rtfeldman.com>
2026-03-18 22:49:16 +00:00
Mikayla Maki
67d7f99891
Fix shared database test isolation (#51809)
All of the important changes are in
[`db.rs`](https://github.com/zed-industries/zed/pull/51809/changes#diff-2f644eab943bfa58feec29256281a3d9e8d4d7784cd34783e845af8beb15b16d).
Consider reading the commit log in order to review this work.

The DB crate's macro and API was changed to fix flakiness observed in
the MultiWorkspace tests when run locally. This flakiness was caused by
a shared `static LazyLock`, that caused concurrent test runs to interact
with the same underlying in-memory database. This flakiness wasn't
possible on CI due to it's usage of `cargo nextest`, whose
process-per-test approach masked this problem.

Essentially, I've changed the `static_connection` macro to remove the
static database variable and redone the internal model. Now, all
database types are thin wrappers around a generic `AppDatabase`. The
`AppDatabase` collects all of the individual table's migrations via the
`inventory` crate, and so only runs the migrations once on startup,
rather than a dozen times on startup.

The new API requires a `cx` so that we can replace the database returned
at runtime, rather than relying exclusively on a process-global
thread-local. However, we are still using a `static LazyLock` so that we
only need to take an `&App`, instead of an `&mut App`. These databases
types are `Clone + Send + Sync`, so you can easily capture-and-move the
database into background tasks and other places that don't have a `cx`.

For tests that require database isolation, it is now possible to set
their own database in init. See
[`workspace::init_test`](https://github.com/zed-industries/zed/pull/51809/changes#diff-041673bbd1947a35d45945636c0055429dfc8b5985faf93f8a8a960c9ad31e28R13610),
for the flakiness fix.

Best part, this change should be entirely compiler driven, so the Zed
agent was able to make the app-wide refactor easily.

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:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-03-18 12:05:57 -07:00
Matt Van Horn
00bee4515e
git_ui: Add starts_open setting to git panel (#51601)
Fixes #51542

Adds a `git_panel.starts_open` setting for parity with `project_panel`.
When set to `true`, the git panel opens automatically in new workspaces
that don't have saved panel state.

The default is `false`, matching current behavior (non-breaking).

### Usage

```json
{
  "git_panel": {
    "starts_open": true
  }
}
```

### Implementation

Follows the same pattern as `project_panel.starts_open`:

1. `GitPanelSettingsContent` - added `starts_open: Option<bool>` to the
settings schema
2. `GitPanelSettings` - added `starts_open: bool` field
3. `GitPanel` Panel impl - overrides `starts_open()` to read from
settings

Release Notes:

- Added `git_panel.starts_open` setting to control whether the git panel
opens automatically in new workspaces (default: false)

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 15:22:45 +00:00
ᴀᴍᴛᴏᴀᴇʀ
c44f13cca0
git_ui: Improve delete branch tests to verify underlying repository state (#51825)
While fixing the tests in the previous PR (#48338), I noticed that the
`delete_branch` tests only verified the UI state changes rather than the
actual state of the underlying repository.

Currently, if `delete_branch` were a no-op that returned Ok(), the tests
would still pass incorrectly. This PR addresses that gap by ensuring the
branch is actually removed from the repository.

|Before|After|
|--|--|
|<img width="3476" height="2564" alt="图片"
src="https://github.com/user-attachments/assets/f5c4c5c4-64fe-4074-9fff-fb166d160d77"
/>|<img width="3476" height="2564" alt="CleanShot 2026-03-18 at 17 51
36@2x"
src="https://github.com/user-attachments/assets/47419d37-5051-4139-969e-65a1347bf555"
/>|

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
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-18 13:11:08 +00:00
ᴀᴍᴛᴏᴀᴇʀ
ed2c08fc4e
git_ui: Fix branch picker deleting remote instead of remote branch (#48338)
Closes #48256

It appears that the current git remotes support was implemented in
#42819, following the design described in
https://github.com/zed-industries/zed/pull/42486#issuecomment-3524092306.
That design does not include an interaction for deleting remotes, but
the delete remote branch action was mistakenly implemented as deleting
the remote itself.

After this PR, there should be no code paths that use `remove_remote`
anymore. I've kept it for now though, as it may be useful when we
introduce the corresponding interaction in the future.

Release Notes:

- Fixed a bug where deleting a remote branch from the branch picker
would incorrectly remove the entire remote configuration
2026-03-18 08:39:56 +00:00
Remco Smits
cd1211f70d
git_ui: Fix select previous selects a non-visible item (#49289)
This PR fixes that when you are below a header and want to select a
previous item, we would select a non-visible item because we did a -1 of
the newly selected index, which could end up inside a collapsed
directory.

**Note**: This is only an issue for the git tree view mode.

**Before** (See selection is not visible anymore after select previous,
because it's inside the collapsed directory)


https://github.com/user-attachments/assets/bd032768-b947-45f8-b5a1-6185010202cf

**After** (See selection now selects the first visible item in the list
which is the collapsed directory)


https://github.com/user-attachments/assets/47f67237-be7c-4ef5-8b99-6a3a2b016086

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:

- Git UI: Fix selecting previous item would select a non-visible item if
it's inside a collapsed directory
2026-03-17 07:36:16 +00:00
ISHIMWE Vainqueur
ae445634e0
git_ui: Show uncommitted change count badge on git panel icon (#49624)
## Summary

- Implements `icon_label` on `GitPanel` to return the total count of
uncommitted changes (`new_count + changes_count`) when non-zero, capped
at `"99+"` for large repos.
- Updates `PanelButtons::render()` to render that label as a small green
badge overlaid on the panel's sidebar icon, using absolute positioning
within a `div().relative()` wrapper.
- The badge uses `version_control_added` theme color and
`LabelSize::XSmall` text with `LineHeightStyle::UiLabel` for accurate
vertical centering, positioned at the top-right corner of the icon
button.

The `icon_label` method already existed on the `Panel`/`PanelHandle`
traits with a default `None` impl, and was already implemented by
`NotificationPanel` (unread notification count) and `TerminalPanel`
(open terminal count) — but was never rendered. This wires it up for all
three panels at once.

## Notes

- Badge is positioned with non-negative offsets (`top(0)`, `right(0)`)
to stay within the parent container's bounds. The status bar's
`render_left_tools()` uses `.overflow_x_hidden()`, which in GPUI clips
both axes (the `overflow_mask` returns a full content mask whenever any
axis is non-`Visible`), so negative offsets would be clipped.
- `LineHeightStyle::UiLabel` collapses line height to `relative(1.)` so
flex centering aligns the visual glyph rather than a
taller-than-necessary line box.
- No new data tracking logic — `GitPanel` already maintains `new_count`
and `changes_count` reactively.
- No feature flag or settings added per YAGNI.

## Suggested .rules additions

The following pattern came up repeatedly and would prevent future
sessions from hitting the same issue:

```
## GPUI overflow clipping

`overflow_x_hidden()` (and any single-axis overflow setter) clips **both** axes in GPUI.
The `overflow_mask()` implementation in `style.rs` returns a full `ContentMask` (bounding box)
whenever any axis is non-`Visible`. Absolute-positioned children that extend outside the element
bounds will be clipped even if only the X axis is set to Hidden.
Avoid negative `top`/`right`/`bottom`/`left` offsets on absolute children of containers
that have any overflow hidden — keep badge/overlay elements within the parent's bounds instead.
```

Release Notes:

- Added a numeric badge to the git panel sidebar icon showing the count
of uncommitted changes.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-03-16 12:57:20 -03:00
Danilo Leal
70a742eadc
git_ui: Don't display the merge conflict notification if an agent is running (#51498)
This PR is motivated by internal feedback in which the notification that
we show inviting to resolve merging conflicts with an agent also pops up
if the agent itself ran `git merge`. In this case, the notification is
unnecessary noise. So, what I'm doing here is simply _not_ showing it if
there's a running agent.

I want to note that this change is accepting a trade-off here, in which
there could be cases that even if an agent is running, the notification
can still be useful. There could be other ways to identify whether the
agent is running `git merge`, but they all felt a bit too complex for
the moment. And given this is reasonably an edge case, I'm favoring a
simple approach for now.

Release Notes:

- N/A

---------

Co-authored-by: Lukas Wirth <lukas@zed.dev>
2026-03-16 16:30:32 +01:00
Jongchan
c54fe0f3e5
git_ui: Add file and folder icons to the Git panel (#51000)
Closes https://github.com/zed-industries/zed/discussions/49740

Adds optional file and folder icons to the Git panel so its file list is
easier to scan, especially in larger repositories.

- add folder icons for Git panel entries
- add Git panel settings for file and folder icon visibility

---

Release Notes:

  - Made the Git Panel aware of icon themes.
  - Added the ability to render file type icons in the Git panel.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-03-16 11:06:37 -03:00
Danilo Leal
4e8937b62d
ui: Refactor the Button component icon methods (#51496)
Previously, if you wanted to have a button that contains icons on both
edges, you'd need to use a `ButtonLike` component, which takes any
children. Meanwhile, the `Button` would only take one icon, where you
could control its position through the `IconPosition` enum. This has
always felt unnecessarily limiting. So, this PR removes this limitation
by adding two new methods to the button: `start_icon` and `end_icon`.

In the meantime, I have also been bothered by the unnecessary
indirection in the `IconButton` due to the existence of the `ButtonIcon`
component. So I figured I could also completely eliminate that by adding
some of its methods directly to the `IconButton` and in the Button, just
using a regular `Icon` component.

---
## Before
```rust
Button::new("id", "Label")
    .icon(IconName::Plus)
    .icon_position(IconPosition::Start)
    .icon_size(IconSize::Small)
    .icon_color(Color::Muted)
```

## After
```rust
Button::new("id", "Label")
    .start_icon(Icon::new(IconName::Check))
    .end_icon(Icon::new(IconName::ChevronDown).size(IconSize::XSmall))
```

This should have no visual impact to the UI.

Release Notes:

- N/A
2026-03-13 14:13:12 -03:00
Lukas Wirth
3bc4b584b1
editor: Replace BreadcrumbText with HighlightedText (#51083)
Remove the BreadcrumbText struct from workspace and use the existing
HighlightedText struct from the language crate instead. The per-segment
font field is replaced by returning an optional Font alongside the
segments from the breadcrumbs() method, since the font was always
uniform across all segments of a given item.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-13 08:00:22 +00:00
Danilo Leal
d4bb640555
git_ui: Remove unused ProjectDiffEmptyState component (#51436)
Just cleaning up our component set a bit. This one wasn't used at all.

Release Notes:

- N/A
2026-03-12 21:09:53 -03:00
Danilo Leal
3c82ddf261
git_ui: Fix "resolve with agent" merge conflict notification (#51290)
Follow up to https://github.com/zed-industries/zed/pull/49807

This PR fixes the merge conflict notification by making it appear only
once per a given set of conflicted paths, as opposed to showing every
time the `ConflictsUpdated` or `StatusesChanged` even would fire.

Release Notes:

- N/A
2026-03-11 11:35:59 -03:00
Lukas Wirth
b21f4a3deb
Prevent remote edits from triggering edit predictions when collaborating (#51196)
BufferEvent::Edited had no way to distinguish local edits from remote
(collaboration) edits. This caused edit prediction behavior to fire on
the guest's editor when the host made document changes.

Release Notes:

- Fixed edit predictions triggering on collaboration guests when the
host edits the document.

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-10 15:23:49 +00:00
Danilo Leal
f18567c1f0
git: Add the ability to resolve merge conflicts with the agent (#49807)
This PR adds a "Resolve with Agent" button in each merge conflict block,
as well as "Resolve Conflicts with Agents" button on a notification for
resolving conflicts across all the files that have any. When clicking on
either of these buttons, the agent panel opens up with a template prompt
auto-submitted. For the first case, the specific content of the merge
block is already attached as context for the agent to act quickly, given
it's a local and small context. For the second case (all conflicts
across the codebase), the prompt just indicates to the agent which files
have conflicts and then it's up for the agent to see them. This felt
like a simpler way to go as opposed to extracting the content for all
merge conflicts across all damaged files.

Here's how the UI looks like:

<img width="550" height="1964" alt="Screenshot 2026-02-21 at 11  04@2x"
src="https://github.com/user-attachments/assets/96815545-ba03-40e5-9cb0-db0ce9588915"
/>

---

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:

- Git: Added the ability to quickly resolve merge conflicts with the
agent.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-03-10 11:19:26 -03:00
Kirill Bulatov
d788673f1e
Do not derive symbol highlights if they do not fit into multi buffer (#50948)
Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-03-09 15:50:44 +00:00
Piotr Osiewicz
97421c670e
Remove unreferenced dev dependencies (#51093)
This will help with test times (in some cases), as nextest cannot figure
out whether a given rdep is actually an alive edge of the build graph

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A
2026-03-09 13:22:12 +01:00
Dino
0a436bec17
git: Introduce restore and next action (#50324)
Add a `git::RestoreAndNext` action that restores the diff hunk at the
cursor and advances to the next hunk. In the git diff view, the default
restore keybinding (`cmd-alt-z` on macOS, `ctrl-k ctrl-r` on
Linux/Windows) is remapped to this action so users can quickly restore
hunks in sequence. Also refactor `go_to_hunk_before_or_after_position`
to accept a `wrap_around` parameter, eliminating duplicated
hunk-navigation logic in `do_stage_or_unstage_and_next` and
`restore_and_next`.

Release Notes:

- Added a `git: restore and next` action that restores the diff hunk at
  the cursor and moves to the next one. In the git diff view, the
  default restore keybinding (`cmd-alt-z` on macOS, `ctrl-k ctrl-r` on
  Linux/Windows) now triggers this action instead of `git: restore`.

---------

Co-authored-by: Afonso <4775087+afonsograca@users.noreply.github.com>
2026-03-09 10:50:43 +00:00
Smit Barmase
ba8f4d839a
git_ui: Fix mouse cursor hiding when clicking git entry in project diff (#51016)
Release Notes:

- Fixed mouse cursor disappearing when clicking a changed file in the Git Changes panel.
2026-03-07 23:38:28 +05:30
David Alecrim
53fca25ba5
git_ui: Add ability to delete git worktrees from picker (#50015)
Adds the ability to delete a git worktree directly from the worktree
picker, inspired by the existing branch delete functionality.


(`cmd-shift-backspace` on macOS, `ctrl-shift-backspace` on
Linux/Windows).

Screenshot:
<img width="1288" height="466" alt="Screenshot 2026-02-24 at 16 01 05"
src="https://github.com/user-attachments/assets/6ca5048d-63fa-4295-a578-358904bb92eb"
/>

Release Notes:

- Added the ability to delete a git worktree from the worktree picker

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
2026-03-04 21:49:06 +00:00
Anthony Eid
5c91ebf1fe
git: Move diff num stat calculation to repository snapshot layer (#50645)
Follow up on: https://github.com/zed-industries/zed/pull/49519

This PR reworks how Zed calculates diff num stats by moving the
calculation to the `RepositorySnapshot` layer, instead of the
`GitPanel`. This has a couple of benefits:

1. Snapshot recalculations are already set up to recompute on file
system changes and only update the affected files. This means that diff
stats don't need to manage their own subscription or states anymore like
they did in the original PR.
2. We're able to further separate the data layer from the UI. Before,
the git panel owned all the subscriptions and tasks that refreshed the
diff stat, now the repository does, which is more inline with the code
base.
3. Integration tests are cleaner because `FakeRepository` can handle all
the data and calculations of diff stat and make it accessible to more
tests in the codebase. Because a lot of tests wouldn't initialize the
git panel when they used the git repository.
4. This made implementing remote/collab support for this feature
streamline. Remote clients wouldn't get the same buffer events as local
clients, so they wouldn't know that the diff stat state has been updated
and invalidate their data.
5. File system changes that happened outside of Zed now trigger the diff
stat refresh because we're using the `RepositorySnapshot`.

I added some integration tests as well to make sure collab support is
working this time. Finally, adding the initial diff calculation to
`compute_snapshot` didn't affect performance for me when checking
against chromium's diff with HEAD~1000. So this should be a safe change
to make.

I decided to add diff stats on the status entry struct because it made
updating changed paths and the collab database much simpler than having
two separate SumTrees. Also whenever the UI got a file's status it would
check its diff stat as well, so this change makes that code more
streamlined as well.

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.

Release Notes:

- N/A
2026-03-04 18:54:23 +00:00
Richard Feldman
7c9a9d40c0
Add "Start Thread in New Worktree" (#49141)
Add the thread target selector in the agent panel behind the
`agent-git-worktrees` flag:

<img width="590" height="121" alt="Screenshot 2026-03-02 at 11 50 47 PM"
src="https://github.com/user-attachments/assets/17ee3303-7e01-4e40-bb84-1e7e748a3196"
/>

- Add a "Start Thread In..." dropdown to the agent panel toolbar, gated
behind `AgentV2FeatureFlag`
- Options: "Local Project" (default) and "New Worktree"
- The "New Worktree" option is disabled when there's no git repository
or in collab mode

Closes AI-34

Release Notes:

- N/A

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Oleksiy Syvokon <oleksiy@zed.dev>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: morgankrey <morgan@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
Co-authored-by: Finn Evers <finn@zed.dev>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: MostlyK <135974627+MostlyKIGuess@users.noreply.github.com>
Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: John Tur <john-tur@outlook.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Wuji Chen <chenwuji2000@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Kasper Nyhus <kanyhus@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Josh Robson Chase <josh@robsonchase.com>
Co-authored-by: ozacod <47009516+ozacod@users.noreply.github.com>
Co-authored-by: ozacod <ozacod@users.noreply.github.com>
Co-authored-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Lena <241371603+zelenenka@users.noreply.github.com>
Co-authored-by: 0x2CA <2478557459@qq.com>
Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
Co-authored-by: Albab Hasan <155961300+Albab-Hasan@users.noreply.github.com>
Co-authored-by: KyleBarton <kjb@initialcapacity.io>
Co-authored-by: Kunall Banerjee <hey@kimchiii.space>
Co-authored-by: Lukas Wirth <lukas@zed.dev>
Co-authored-by: Tom Houlé <13155277+tomhoule@users.noreply.github.com>
Co-authored-by: Nikhil Pandey <nikhil@nikhil.com.np>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: dancer <144584931+dancer@users.noreply.github.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-03-03 15:25:36 +00:00
Oliver Azevedo Barnes
f9895c5468
devcontainer: Fix git output (#49230)
Closes #48434

In Dev Containers, failed git operations were surfaced with a generic
failure message, while the useful git output (stderr/stdout) was not
reliably available to users.

This happened because in devcontainers the git operation errors go
through an RPC layer and then got wrapped with `anyhow::Context` (e.g.
“sending pull request”); the toast displayed only that outer context via
`to_string()`, masking the underlying git stderr message.

This change ensures the full git operation output is preserved and
surfaced via Zed’s “See logs” flow in Dev Containers, matching the
information you get when running the same git command in a terminal.

### What you should expect in the UI
- You will see a generic toast like “git pull failed” / “git push
failed”.
- When clicking on the toast’s “See logs”, the log tab now contains the
full git error output (e.g. non-fast-forward hints, merge conflict
details, “local changes would be overwritten”, etc.), which previously
could be missing/too generic.
---

## Manual testing

Run inside a Dev Container and ensure git auth works (SSH keys/agent or
HTTPS credentials).

1. **Dirty-tree pull failure**
   - Make remote ahead by 1 commit (push from another clone).
   - Locally modify the same file without committing.
   - In Zed: **Pull**  
- **Expect:** toast “git pull failed” + **See logs** shows “local
changes would be overwritten…” (or equivalent).

2. **Non-fast-forward push failure**
   - Ensure remote ahead.
   - Locally create 1 commit.
   - In Zed: **Push**  
- **Expect:** toast “git push failed” + **See logs** shows “rejected
(non-fast-forward)” + hint to pull first.

3. **Merge-conflict pull failure**
- Create conflicting commits on the same lines (one local commit, one
remote commit).
   - In Zed: **Pull**  
- **Expect:** toast “git pull failed” + **See logs** shows conflict
output (“CONFLICT…”, “Automatic merge failed…”).

Release Notes:

- Fixed devcontainer git failure toasts so they show the actual git
error

---------

Co-authored-by: KyleBarton <kjb@initialcapacity.io>
2026-03-02 09:10:12 -08:00
Cole Miller
db02d09331
git: Fix conflicted paths not getting cleared (#50327)
Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a bug where files would still be marked as having git conflicts
after resolving them.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-03-02 13:40:34 +00:00
Lukas Wirth
c05e5859c6
Detect leaked entities at the end of test runs (#50400)
This does not yet allow for finding task <-> entity cycles
unfortunately, but at least it does catch entity <-> entity cycles for
the time being

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-02 12:04:13 +01:00
Tom Houlé
6a749380aa
Add fast mode toggle in agent panel (#49714)
This is a staff only toggle for now, since the consequences of
activating it are not obvious and quite dire (tokens costs 6 times
more).

Also, persist thinking, thinking effort and fast mode in DbThread so the
thinking mode toggle and thinking effort are persisted.

Release Notes:

- Agent: The thinking mode toggle and thinking effort are now persisted
when selecting a thread from history.
2026-02-26 21:19:41 +01:00
Cole Miller
be5763632d
Start removing callers of legacy excerpt APIs (#50144)
Paving the way to remove `ExcerptId`. Done in this PR:

- Unshipped the stack trace view
- Get rid of `push_excerpts`
- Get rid of some callers of `remove_excerpts`

We still need to remove some calls to `remove_excerpts` and other APIs,
especially in `randomly_edit_excerpts` and collaboration.

Release Notes:

- The stack trace multibuffer view has been removed.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-02-26 10:37:43 -05:00
Cameron Mcloughlin
10bbcdfec5
Side by side diff spacer polish (#50182)
Co-authored-by: Cole Miller <cole@zed.dev>
2026-02-26 10:47:10 +00:00
Bob Mannino
bbbe7239af
git: Add diff stats in git_panel (#49519)
This PR adds the small UI change of `git diff --numstat` to the git
panel so you can see the number of additions/deletions per file. There
is an option in the settings UI for this under `git_panel`.`diff_stats`.
This option is set to `false` by default.

<!-- initial version <img width="1648" height="977" alt="Screenshot
2026-02-18 at 18 42 47"
src="https://github.com/user-attachments/assets/b8b7f07c-9c73-4d06-9734-8f1cf30ce296"
/> -->

<img width="1648" height="977" alt="Screenshot 2026-02-18 at 21 25 02"
src="https://github.com/user-attachments/assets/73257854-6168-4d12-84f8-27c9e0abe89f"
/>


Release Notes:

- Added git diff stats to git panel entries

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
2026-02-25 18:32:22 +01:00
Danilo Leal
13eb0f6832
git_ui: Improve connection between the graph and commit views (#50027)
- Enabled opening the Git Graph, with the corresponding commit detail
drawer open, from the commit view
- Redesigned the commit view's header and toolbar to allow addition of
the Git Graph icon button
- Redesigned icons for the Git Graph and commit view


https://github.com/user-attachments/assets/8efef60a-0893-4752-9b40-838da21ceb54

---

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:

- N/A (_Git Graph is still feature flagged, so no release notes for
now_)
2026-02-25 10:45:14 -03:00
Conrad Irwin
cb793a4667
Fix a panic when git askpass triggers during commit (#50057)
Fixes ZED-597

Release Notes:

- Fixed a panic when the askpass dialogue opened while committing.
2026-02-25 05:55:32 +00:00