Skip to content

Conversation

@xipeng-jin
Copy link
Contributor

Closes #40851

Release Notes:

  • Fixed: Commit diff multibuffers now open real project files whenever possible, restoring navigation and annotations inside those excerpts.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 12, 2025
@xipeng-jin xipeng-jin marked this pull request as draft November 12, 2025 18:54
@xipeng-jin
Copy link
Contributor Author

xipeng-jin commented Nov 12, 2025

There is something I noticed can be optimized, so I am still working on it. I am also trying to validate that behaving correctly in all cases. Thanks

@cole-miller
Copy link
Member

cole-miller commented Nov 13, 2025

Thanks! I don't think we want to use "real" files in the commit view multibuffer, though. We need to show the content of each path as it existed at the time of the commit, not the current content.

I think the right way to approach this is to make editor::OpenExcerpts and editor::OpenExcerptsSplit work with the GitBlob files that the commit view uses. Right now this is explicitly disabled by Editor::can_open_excerpts_in_file, so we should lift that restriction and then make sure that the resulting editor is opened read-only. We should also make sure it's visually clear that the opened editor is not a project file, by customizing the tab content (maybe this could mention the SHA).

@cole-miller
Copy link
Member

Feel free to book a time here if you'd like to pair on it: https://cal.com/esther-trapadoux-zed/30min

@xipeng-jin
Copy link
Contributor Author

Thanks @cole-miller , I have booked a time on next Tuesday and happy to pair with you. I took a look at your last comment further yesterday and agree it was not a good idea to expose the "real" files for commit view. Editor::can_open_excerpts_in_file is indeed disable that, so I am starting from that point. But I might need more thoughts on how we should customize the tab content to make it visually clear it is not from a project file later today.

@alphathekiwi
Copy link
Contributor

Hey @xipeng-jin I see we have an interest in a lot of the same issues, I have also been working on tackling this. And had a Pair session last week to discuss my progress. (Only just published now)
#42760

Basically there are 3 possibility
The user wants to navigate to the Parent file (before changes were applied)
The user wants to navigate to the Modified file
The user wants to open the file at HEAD (maybe they were just looking at historical code and now want to modify the file)

We could try to assume the users intent with a smart OpenExcept action that would try to open the Parent file if the cursor is inside a removed hunk and the Modified file if the cursor is inside an added hunk.

But that doesn't consider what action to take when the cursor is in a section of unmodified text. Nor does it allow the user to open the file in the HEAD

The route I have ended up taking is to make a bunch of settings and some fallbacks, (what to do when the user's first choice action is not possible in the given context).

I would love to attend your pairing session as a spectator or potentially contribute what I've done to your efforts. I am eager to see this feature get added in some fashion as it has been a big pain point for me.

@xipeng-jin
Copy link
Contributor Author

Hi @alphathekiwi , I took a quick glance of your PR and really appreciate your effort and interest here. I am happy to collaborate with you in this one if you like. Something I think we might need to narrative the size of this PR, and we also might want to consider to separate out the large PR into several small ones to make reviewing easier. Yes, I did book a time with the team to have a concrete idea with the UI changes. I will send out the invite for you if you have time.

Appreciate for your feedback and contribution here and happy to collaborate with you in this one to shipping the best shape of the feature. Thanks

@xipeng-jin xipeng-jin force-pushed the issue/git-commit-multibuffer-nav-40851 branch from d8caf1b to a3934da Compare November 19, 2025 12:51
@xipeng-jin xipeng-jin marked this pull request as ready for review November 19, 2025 12:52
@esthertrapadoux
Copy link

@xipeng-jin I think you're already chatting with @Anthony-Eid but we have more pairing slots with the team in case you want to grab one! https://cal.com/esther-trapadoux-zed/30min?overlayCalendar=true

Let me know if you don't see any open slots during your time zone. I can open up more.

@xipeng-jin
Copy link
Contributor Author

Hi @esthertrapadoux , thanks for reaching out, but I cannot see any open slots in this week. The earliest spot is next Monday. I am happy to grab some pairing slots in this week if the team is available. Thank you.

@Anthony-Eid Anthony-Eid self-assigned this Dec 3, 2025
Co-authored-by: xipengjin <jinxp18@gmail.com>
@Anthony-Eid Anthony-Eid enabled auto-merge (squash) December 3, 2025 16:20
@Anthony-Eid Anthony-Eid disabled auto-merge December 3, 2025 16:27
Co-authored-by: xipengjin <jinxp18@gmail.com>
@Anthony-Eid Anthony-Eid merged commit 85ccd7c into zed-industries:main Dec 3, 2025
23 checks passed
@xipeng-jin xipeng-jin deleted the issue/git-commit-multibuffer-nav-40851 branch December 3, 2025 17:12
@esthertrapadoux esthertrapadoux moved this from Community PRs to Shipped by Community in Quality Week – December 2025 Dec 10, 2025
@esthertrapadoux esthertrapadoux moved this to 🚢 Shipped by Community in Git board Dec 10, 2025
CherryWorm pushed a commit to CherryWorm/zed that referenced this pull request Dec 16, 2025
…stries#42558)

Closes zed-industries#40851

Release Notes:

- Fixed: Commit diff multibuffers now open real project files whenever
possible, restoring navigation and annotations inside those excerpts.

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
someone13574 pushed a commit to someone13574/zed that referenced this pull request Dec 16, 2025
…stries#42558)

Closes zed-industries#40851

Release Notes:

- Fixed: Commit diff multibuffers now open real project files whenever
possible, restoring navigation and annotations inside those excerpts.

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

5 participants