Skip to content

git_ui: Open file diffs from git panel - #56152

Merged
ChristopherBiscardi merged 3 commits into
zed-industries:mainfrom
chirivelli:feat/open-diff-in-solo-splittableeditor
May 29, 2026
Merged

git_ui: Open file diffs from git panel#56152
ChristopherBiscardi merged 3 commits into
zed-industries:mainfrom
chirivelli:feat/open-diff-in-solo-splittableeditor

Conversation

@chirivelli

Copy link
Copy Markdown
Collaborator

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
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Addresses #33773.

This changes git panel file activation so double-clicking or secondary-opening a changed file opens a dedicated full-file diff tab backed by a SplittableEditor.

The per-file diff reuses the project diff staging and restore controls, respects the configured diff view style, and focuses an existing per-file diff tab when one is already open instead of creating duplicates.

Verified with cargo run.

Release Notes:

  • Improved git panel file diff opening.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 8, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label May 8, 2026
this.selected_entry = Some(ix);
cx.notify();
if event.click_count() > 1 || event.modifiers().secondary() {
this.open_file(&Default::default(), window, cx)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old behaviour didn't support split (side-by-side) diff

@nitedani

nitedani commented May 8, 2026

Copy link
Copy Markdown

This changes git panel file activation so double-clicking or secondary-opening a changed file opens a dedicated full-file diff tab backed by a SplittableEditor.

This was exactly what I expected to happen when using Zed for the first time and double-clicked a file in git panel.
Thank you for making it happen!

@scratchmex

scratchmex commented May 8, 2026

Copy link
Copy Markdown

Can you share a video or screenshots? Thanks for the contrib

@nitedani

nitedani commented May 8, 2026

Copy link
Copy Markdown

A few ideas:

  • A config option to set this behavior to the default single-click instead of double-click.
  • A button to swap between the default multi-buffer view and the full-file view.
image

Not sure about them.

Other feedback:
The first button in the attached image already collapses/expands all files in the multi-buffer view. Note that it does not expand all file content. Instead of this PR, wouldn't a config option + button suffice that would expand all file content in the multi-buffer view? And if so, can that be implemented performantly?

Which way is more intuitive for the user?

@franciskafyi franciskafyi linked an issue May 8, 2026 that may be closed by this pull request
@ChristopherBiscardi ChristopherBiscardi added the area:integrations/git Git integration feedback label May 8, 2026
@chirivelli
chirivelli force-pushed the feat/open-diff-in-solo-splittableeditor branch from 63adc2a to bd873d4 Compare May 9, 2026 04:25
@chirivelli

Copy link
Copy Markdown
Collaborator Author

@Anthony-Eid

@Anthony-Eid Anthony-Eid self-assigned this May 12, 2026
@chirivelli
chirivelli marked this pull request as draft May 15, 2026 08:48
@chirivelli
chirivelli force-pushed the feat/open-diff-in-solo-splittableeditor branch from bd873d4 to ac6182a Compare May 15, 2026 12:05
@chirivelli

Copy link
Copy Markdown
Collaborator Author

Added a dedicated SoloDiffView for opening a single changed file from the Git panel. Previously this flow reused the project diff, which worked but felt less focused for per-file review. The new view opens the full file diff in its own tab, follows the configured unified/split diff style, supports the same git hunk/file actions.

here is a look at the new view

Screen.Recording.2026-05-15.at.5.40.51.PM.mov

@Anthony-Eid @franciskafyi

@chirivelli
chirivelli marked this pull request as ready for review May 15, 2026 12:13
@franciskafyi franciskafyi linked an issue May 28, 2026 that may be closed by this pull request

@ChristopherBiscardi ChristopherBiscardi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I've tested this and it functions as expected.

@ChristopherBiscardi
ChristopherBiscardi added this pull request to the merge queue May 29, 2026
Merged via the queue into zed-industries:main with commit 5d3b9e4 May 29, 2026
33 checks passed
@chirivelli

Copy link
Copy Markdown
Collaborator Author

Thanks man 🤝

TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 2, 2026
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

Addresses zed-industries#33773.

This changes git panel file activation so double-clicking or
secondary-opening a changed file opens a dedicated full-file diff tab
backed by a `SplittableEditor`.

The per-file diff reuses the project diff staging and restore controls,
respects the configured diff view style, and focuses an existing
per-file diff tab when one is already open instead of creating
duplicates.

Verified with `cargo run`.

Release Notes:

- Improved git panel file diff opening.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
@chirivelli
chirivelli deleted the feat/open-diff-in-solo-splittableeditor branch June 4, 2026 13:47
@Syntist

Syntist commented Jun 7, 2026

Copy link
Copy Markdown

Is it possible to force this on click by default? instead of always doing cmd/ctrl + click.

@daguttt

daguttt commented Jun 10, 2026

Copy link
Copy Markdown

@Syntist I'm also looking to achieve that as the default

@axsuul

axsuul commented Jun 18, 2026

Copy link
Copy Markdown

Is there any way to get the old behavior back? It was really convenient to be able to open the file in that location

@chirivelli

Copy link
Copy Markdown
Collaborator Author

Is there any way to get the old behavior back? It was really convenient to be able to open the file in that location

"opt + enter" still opens the file

@axsuul

axsuul commented Jun 18, 2026

Copy link
Copy Markdown

Is there any way to get the old behavior back? It was really convenient to be able to open the file in that location

"opt + enter" still opens the file

It's not the same, it seems to open it in a locked file view and the file is not editable

@chirivelli

Copy link
Copy Markdown
Collaborator Author

@axsuul
#59383 this should fix it, will be in a 1.8 release!

@axsuul

axsuul commented Jun 18, 2026

Copy link
Copy Markdown

@axsuul #59383 this should fix it, will be in a 1.8 release!

Thanks so much!

@nathan-fiscaletti

Copy link
Copy Markdown
Contributor

Is it possible to force this on click by default? instead of always doing cmd/ctrl + click.

I put together a PR that achieves this.

#59649

pull Bot pushed a commit to Superoldman96/zed that referenced this pull request Jun 22, 2026
…ed-industries#59649)

# Objective

The current behavior of the git panel is that when you click a file it
will open the multi-buffer view that shows all files with changes. If
you use CMD+Click or CTRL+Click, it will open the solo-file experience
where you only see the diff of the file you have selected. But, there is
no way to customize this behavior.

Related to:
zed-industries#56152 (comment)

## Solution

This MR adds a setting that allows you to customize the default click
behavior. The alternate behavior will always be accessible via CMD+Click
or CTRL+Click.

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [X] Tests cover the new/changed behavior
- [X] Performance impact has been considered and is acceptable

---

Release Notes:

- Added a setting to control default click behavior for git panel files

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
saranblock3 pushed a commit to saranblock3/zed that referenced this pull request Jun 23, 2026
…ed-industries#59649)

# Objective

The current behavior of the git panel is that when you click a file it
will open the multi-buffer view that shows all files with changes. If
you use CMD+Click or CTRL+Click, it will open the solo-file experience
where you only see the diff of the file you have selected. But, there is
no way to customize this behavior.

Related to:
zed-industries#56152 (comment)

## Solution

This MR adds a setting that allows you to customize the default click
behavior. The alternate behavior will always be accessible via CMD+Click
or CTRL+Click.

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [X] Tests cover the new/changed behavior
- [X] Performance impact has been considered and is acceptable

---

Release Notes:

- Added a setting to control default click behavior for git panel files

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
weihuoya pushed a commit to weihuoya/zed that referenced this pull request Jun 25, 2026
…ed-industries#59649)

# Objective

The current behavior of the git panel is that when you click a file it
will open the multi-buffer view that shows all files with changes. If
you use CMD+Click or CTRL+Click, it will open the solo-file experience
where you only see the diff of the file you have selected. But, there is
no way to customize this behavior.

Related to:
zed-industries#56152 (comment)

## Solution

This MR adds a setting that allows you to customize the default click
behavior. The alternate behavior will always be accessible via CMD+Click
or CTRL+Click.

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [X] Tests cover the new/changed behavior
- [X] Performance impact has been considered and is acceptable

---

Release Notes:

- Added a setting to control default click behavior for git panel files

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
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

Addresses zed-industries#33773.

This changes git panel file activation so double-clicking or
secondary-opening a changed file opens a dedicated full-file diff tab
backed by a `SplittableEditor`.

The per-file diff reuses the project diff staging and restore controls,
respects the configured diff view style, and focuses an existing
per-file diff tab when one is already open instead of creating
duplicates.

Verified with `cargo run`.

Release Notes:

- Improved git panel file diff opening.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
@gaojunran

Copy link
Copy Markdown

also see #62074, which is a follow-up for this PR.

jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
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

Addresses zed-industries#33773.

This changes git panel file activation so double-clicking or
secondary-opening a changed file opens a dedicated full-file diff tab
backed by a `SplittableEditor`.

The per-file diff reuses the project diff staging and restore controls,
respects the configured diff view style, and focuses an existing
per-file diff tab when one is already open instead of creating
duplicates.

Verified with `cargo run`.

Release Notes:

- Improved git panel file diff opening.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ed-industries#59649)

# Objective

The current behavior of the git panel is that when you click a file it
will open the multi-buffer view that shows all files with changes. If
you use CMD+Click or CTRL+Click, it will open the solo-file experience
where you only see the diff of the file you have selected. But, there is
no way to customize this behavior.

Related to:
zed-industries#56152 (comment)

## Solution

This MR adds a setting that allows you to customize the default click
behavior. The alternate behavior will always be accessible via CMD+Click
or CTRL+Click.

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [X] Tests cover the new/changed behavior
- [X] Performance impact has been considered and is acceptable

---

Release Notes:

- Added a setting to control default click behavior for git panel files

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integrations/git Git integration feedback cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Git Diff - Full File View Git Diff - Full File View