Commit graph

39 commits

Author SHA1 Message Date
Cole Miller
73853be484
git: Remove unnecessary block map recomputation when splitting SplittableEditor (#49075)
We had a call to `BlockMap::unfold_intersecting` that ended up
recomputing the entire block map for the RHS _without_ spacers, only to
throw it away in favor of the version with spacers a few lines down. Now
we only sync each block map once in `set_companion`.

Release Notes:

- Improved performance when toggling from the unified diff to the split
diff.

Co-authored-by: Jakub <jakub@zed.dev>
Co-authored-by: Cameron McLoughlin <cameron.studdstreet@gmail.com>
2026-02-13 15:52:04 +00:00
Cole Miller
b17ffdbec1
git: Fix misalignment in the split diff when inlays fall at the end of an excerpt (#49078)
- [x] Tests or screenshots needed?
- [ ] Code Reviewed
- [x] Manual QA

Release Notes:

- Fixed misalignment of lines in the split diff when using inlay hints.
2026-02-13 10:31:06 -05:00
Richard Feldman
ee3f40fe25
Re-add MultiWorkspace (#48800)
Release Notes:

- Added agent panel restoration. Now restarting your editor won't cause
your thread to be forgotten.

---------

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Eric Holk <eric@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
2026-02-12 01:06:23 +00:00
Cole Miller
b53ff3b893
git: Disable some more expensive things for the split diff's left-hand side (#48953)
- Conflict UI
- LSP data
- Runnables

Release Notes:

- Improved performance when opening the split diff view.
2026-02-11 21:58:55 +00:00
Cole Miller
f7314976bd
git: Enable the split diff for everyone (#48912)
Release Notes:

- Added support for viewing diffs in split ("side by side") mode
2026-02-11 06:28:55 +00:00
Cole Miller
05e99dad54
git: Standardize nomenclature for side-by-side diff (#48910)
"Unified" for the old view, and "split" for the new one.

Release Notes:

- N/A
2026-02-11 05:33:03 +00:00
Cole Miller
74419f6a0d
git: Correct logic for updating companion excerpt IDs mapping (#48906)
We try to remove old excerpt IDs from the companion when mutating
excerpts for a path, but we were incorrectly doing this using the
excerpt IDs for the right-hand side multibuffer _after_ any excerpt
mutations had occurred, causing stale excerpt IDs to accumulate.

Release Notes:

- N/A
2026-02-11 04:02:02 +00:00
Cole Miller
c8054cacbd
git: Fix searching in the split diff (#48894)
- Fix panics caused by reusing cached matches for the wrong side
- Highlight matches on the side that was searched only
- Clear matches in non-searched editor when initiating a new search

Release Notes:

- N/A

---------

Co-authored-by: Eric <eric@zed.dev>
Co-authored-by: Jakub <jakub@zed.dev>
2026-02-10 23:29:51 +00:00
Cole Miller
4177be4479
git: Optimize patch_for_range functions (#48852)
These are heavily used by the side-by-side diff. Previously, we were
iterating over all hunks for each call. Now we skip hunks that can't
affect the provided range.

Release Notes:

- N/A
2026-02-10 01:19:01 -05:00
Cole Miller
d7129634ee
git: Fix missing excerpts panic with side-by-side diff (#48755)
When we update excerpts, pull the changes to the `Companion` excerpt
mappings into the multibuffer's update block, so that buffer
subscriptions don't get the chance to run and observe an invalid state
while attempting to snapshot the editor

Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2026-02-09 17:16:11 -05:00
Cameron Mcloughlin
7a18c4126a
git: Side-by-side diff UX improvements (#48821)
- No more "locked mode", it's on by default
- Only `ToggleDiffView` action
- Re-enable code actions on the RHS

Release Notes:

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

---------

Co-authored-by: Cole Miller <cole@zed.dev>
2026-02-09 21:55:47 +00:00
Cole Miller
8582ca68a5
git: Fix a panic in spacer_blocks (#48753)
Closes ZED-4X5

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-09 10:34:55 -05:00
Cole Miller
930f484fe4
git: Follow-up fixes for custom blocks in the side-by-side diff (#48747)
- Ensure that both sides are passed the appropriate companion data to
preserve spacers when syncing
- Remove companion handling in codepaths related to range folding, since
this isn't supported in the side-by-side diff
- Move handling of buffer folding into the block map
- Rework `set_companion` to handle both `DisplayMap`s at once
- DRY some code around block map syncing in the `DisplayMap`

TODO:

- [x] diagnose and fix issue that causes balancing blocks not to render
properly when they are adjacent to spacers (e.g. merge conflict buttons)
- [x] clear balancing blocks when clearing companion
- [x] additional tests: interaction between spacers and balancing
blocks, resizing

Release Notes:

- N/A
2026-02-08 20:10:52 -05:00
Cole Miller
35160555da
git: Fix a potential misalignment in the side-by-side diff (#48690)
Release Notes:

- N/A
2026-02-07 18:07:23 +00:00
Cole Miller
869919160b
git: Add a setting for the default view mode of SplittableEditor (#48440)
Release Notes:

- N/A
2026-02-07 17:26:02 +00:00
Cole Miller
8e56667625
git: Implement OpenExcerpts for the left side of the side-by-side diff (#48438)
By opening the corresponding positions in the corresponding main
buffers.

Release Notes:

- N/A
2026-02-06 15:46:23 +00:00
Jakub Konka
4167f170de
SplittableEditor: Sync custom blocks between RHS and LHS editors (#48575)
Release Notes:

- Added handling of custom blocks in the RHS editor by creating matching
dummy custom blocks rendered as spacer blocks in the LHS editor when in
split view.
2026-02-06 15:15:57 +01:00
Cameron Mcloughlin
8d730846eb
git: Side-by-side search matches panic (#48544)
Fixes a panic when using a search anchor from one side of a side-by-side
in the
other.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-06 00:57:31 +00:00
Cameron Mcloughlin
eb9103e667
git: Side-by-side diff searching (#48539)
Searching (and related vim stuff like `*`/`n`/`N`) now work in the LHS
of a
split diff.

Also fixes the bug with indent guides being visible through the spacer
checkerboard pattern.

Release Notes:

- N/A
2026-02-05 23:45:01 +00:00
Lukas Wirth
74746aa974
multi_buffer: Optimize a bunch of things (#48519)
Release Notes:

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

---------

Co-authored-by: Cole Miller <cole@zed.dev>
2026-02-05 20:10:02 +00:00
Cole Miller
52c963df1d
git: Ensure the sides of the side-by-side diff use the same hunk controls (#48376)
Fixes hunk controls appearing on the LHS of the branch diff when they
should be disabled

Release Notes:

- N/A
2026-02-04 17:07:46 +00:00
Cole Miller
389a20471a
git: Add support for staging/unstaging/restoring to side-by-side diff LHS, and render hunk controls there (#48320)
Release Notes:

- N/A
2026-02-04 05:04:04 +00:00
Cole Miller
8bf3b4fece
git: Refactor buffer_diff point translation APIs for more efficient side-by-side diff syncing (#48237)
The side-by-side diff heavily relies on a primitive from `buffer_diff`
that converts a point on one side of the diff to a range of points on
the other side. The way this primitive is set up on main is pretty
naive--every time we call `points_to_base_text_points` (or
`base_text_points_to_points`), we need to iterate over all hunks in the
diff. That's particularly bad for the case of constructing a new
side-by-side diff starting from a multibuffer, because we call those
APIs once per excerpt, and the number of excerpts is ~equal to the
number of hunks.

This PR changes the point translation APIs exposed by `buffer_diff` to
make it easier to use them efficiently in `editor`. The new shape is a
pair of functions that return a patch that can be used to translate from
the main buffer to the base text or vice versa. When syncing edits
through the block map that touch several excerpts for the same buffer,
we can reuse this patch for excerpts after the first--so when building a
new side-by-side diff, we'll iterate over each hunk just once.

The shape of the new APIs also sets us up to scale down to cases like
editing on the right-hand side of the diff: we can pass in a point range
and give them permission to return an approximate patch that's only
guaranteed to give the correct results when used with points in that
range. For edits that only affect one excerpt, and given how the project
diff is set up, that should allow us to skip iterating over most of the
hunks in a buffer.

Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
2026-02-03 22:18:59 -05:00
Cole Miller
2570382f88
git: Disable vertical scrollbar for side-by-side diff LHS (#48129)
Also the minimap, although this is currently symbolic since the minimap
doesn't support multibuffers.

Release Notes:

- N/A
2026-02-01 05:49:18 +00:00
Cole Miller
608cc9953f
git: Remove panes from SplittableEditor (#48102)
Vestigial from the old UI

Release Notes:

- N/A
2026-01-31 18:50:50 +00:00
Cole Miller
8d18b7b927
git: Fix desynced scrolling between LHS and RHS of side-by-side diff (#47913)
- Remove old attempt to sync scrolling
- Share a `ScrollAnchor` between the two sides, and be sure to resolve
it against the correct snapshot
- Allow either side to initiate an autoscroll request, and make sure
that request is processed in the same frame by the other side

Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Jakub <jakub@zed.dev>
2026-01-31 18:33:22 +00:00
Cole Miller
a09f0bba9c
git: Use LHS/RHS terminology consistently for side-by-side diff (#47949)
We were using primary/secondary in some places which is just
unnecessarily confusing.

Release Notes:

- N/A

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2026-01-29 17:36:15 +00:00
Cole Miller
a21e21c15c
git: Hide toggle split diff button behind feature flag (#47878)
Release Notes:

- N/A

Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2026-01-28 17:15:09 +00:00
Cole Miller
9e2c415abb
git: Fix incorrect spacers for added or deleted files at the end of the multibuffer (#47525)
Release Notes:

- N/A

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-25 22:05:04 -05:00
Cole Miller
c8139fb4e9
git: Fix missing spacers in side-by-side diff when editing inside an addition hunk (#47568)
Release Notes:

- N/A
2026-01-25 21:38:18 -05:00
Cole Miller
6ebcd84182
git: Ensure folded buffers are synced when deploying side-by-side diff (#47498)
Release Notes:

- N/A

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-25 21:25:02 -05:00
Cole Miller
a5eb666951
git: Fix panic when committing from side-by-side view (#47425)
When committing, it was possible for the left-hand side multibuffer to
get the updated base text (via the `buffer_changed_since_sync`
mechanism) without updating its diff snapshot for that buffer (via the
diff subscription), causing a mismatch between that multibuffer's diff
state and its buffer state. The fix is to ensure for inverted diffs that
we always update pull an updated diff snapshot as part of
`sync_from_buffer_changes`.

This also removes some code that we added in #44838 to sync the
left-hand side multibuffer when edits on the right-hand side invalided
diff hunks. Instead, the left-hand side will just sync the next time the
diff recalculates when this happens, and will always consider hunks from
the last diff calculation as valid--so there will be a short window
where the diff transforms and `diff_hunks_in_range` don't match between
the two sides. That's okay because we don't rely on this in the display
map--the code that translates positions between the two sides accesses
the diff's `InternalDiffHunk`s directly rather than going through a
multibuffer API.

Release Notes:

- N/A
2026-01-22 16:17:23 -05:00
Cole Miller
ad8f41a7ce
git: Fix double-lease panic when syncing selections in side-by-side diff (#47430)
Release Notes:

- N/A
2026-01-22 21:10:16 +00:00
Cole Miller
618f848c1f
git: Side-by-side diff UI (#47349)
This PR implements a UI for the side-by-side diff, using blocks to align
the two sides and adding a coherent `SplitEditorElement`.

Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-22 02:31:14 -05:00
Cole Miller
88a153cd18
project_diff: Fix overly large edits being emitted when a diff is recomputed (#46056)
Release Notes:

- N/A
2026-01-05 04:24:07 +00:00
Cole Miller
554382a87e
git: Rework side-by-side diff to use distinct buffers for the left-hand side (#44838)
This PR reworks the (still feature-gated) side-by-side diff view to use
a different approach to representing the multibuffers on the left- and
right-hand sides.

Previously, these two multibuffers used identical sets of buffers and
excerpts, and were made to behave differently by adding a new knob to
the multibuffer controlling how diffs are displayed. Specifically, the
left-hand side multibuffer would filter out the added range of each hunk
from the excerpts using a new `FilteredInsertedHunk` diff transform, and
the right-hand side would simply not show the deleted sides of expanded
hunks. This approach has some problems:

- Line numbers, and actions that navigate by line number, behaved
incorrectly for the left-hand side.
- Syntax highlighting and other features that use the buffer syntax tree
also behaved incorrectly for the left-hand side.

In this PR, we've switched to using independent buffers to build the
left-hand side. These buffers are constructed using the base texts for
the corresponding diffs, and their lifecycle is managed by `BufferDiff`.
The red "deleted" regions on the left-hand side are represented by
`BufferContent` diff transforms, not `DeletedHunk` transforms. This
means each excerpt on the left represents a contiguous slice of a single
buffer, which fixes the above issues by construction.

The tradeoff with this new approach is that we now have to manually
synchronize excerpt ranges from the right side to the left, which we do
using `BufferDiffSnapshot::row_to_base_text_row`.

Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: HactarCE <6060305+HactarCE@users.noreply.github.com>
Co-authored-by: Miguel Raz Guzmán Macedo <miguel@zed.dev>
Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Cameron <cameron@zed.dev>
2025-12-31 20:02:45 -05:00
Mikayla Maki
75c71a9fc5
Kick off agent v2 (#44190)
🔜

TODO:
- [x] Add a utility pane to the left and right edges of the workspace
  - [x] Add a maximize button to the left and right side of the pane
- [x] Add a new agents pane
- [x] Add a feature flag turning these off

POV: You're working agentically

<img width="354" height="606" alt="Screenshot 2025-12-13 at 11 50 14 PM"
src="https://github.com/user-attachments/assets/ce5469f9-adc2-47f5-a978-a48bf992f5f7"
/>



Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Zed <zed@zed.dev>
2025-12-15 10:14:15 +00:00
Cole Miller
a675eb1667
Fix regression in closing project diff (#43964)
Follow-up to #43586--when the diff is not split, just render the primary
editor. Otherwise the child `Pane` intercepts `CloseActiveItem`. (This
is still a bug for the actual split diff, but just fixing the
user-visible regression for now.)

Release Notes:

- N/A
2025-12-02 02:32:36 +00:00
Cole Miller
2e00f40c54
Basic side-by-side diff implementation (#43586)
Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Cameron <cameron@zed.dev>
2025-11-30 22:45:01 -05:00