Skip to content

Fix “Open file in project" option in the right-click menu not working#60807

Open
peakxy wants to merge 1 commit into
zed-industries:mainfrom
peakxy:fix-git-open-file-in-project
Open

Fix “Open file in project" option in the right-click menu not working#60807
peakxy wants to merge 1 commit into
zed-industries:mainfrom
peakxy:fix-git-open-file-in-project

Conversation

@peakxy

@peakxy peakxy commented Jul 11, 2026

Copy link
Copy Markdown

Objective

Fix file header context menu actions in multi-file Git history diffs. Previously, Open File in Project worked for the first file but did nothing for subsequent files.

Fixes #60790

Solution

Include the buffer ID in each file header context menu's GPUI element ID. This prevents multiple file headers in split diff views from sharing the same menu state.

Testing

  • Ran cargo check -p editor --lib.
  • Ran cargo fmt --package editor -- --check.
  • Reviewers can test by opening a multi-file commit from Git Panel → History in split diff mode, then using Open File in Project on the second and subsequent file headers.
CleanShot.2026-07-11.at.18.18.24.mp4

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed opening project files from context menus in multi-file Git history diffs.

Copilot AI review requested due to automatic review settings July 11, 2026 10:28
@cla-bot

cla-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: 徐一峰.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@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 Jul 11, 2026

Copilot AI 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.

Pull request overview

Fixes a GPUI element ID collision that caused file-header context menu actions (notably Open File in Project) to stop working on the 2nd+ file when viewing multi-file Git history diffs.

Changes:

  • Makes the buffer header’s right-click menu element ID unique per buffer by keying it with buffer_id.to_proto(), preventing shared menu state between multiple headers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@peakxy peakxy force-pushed the fix-git-open-file-in-project branch from 24976bf to ad8da13 Compare July 11, 2026 10:37
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 11, 2026
@peakxy

peakxy commented Jul 11, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot

cla-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@peakxy

peakxy commented Jul 11, 2026

Copy link
Copy Markdown
Author

@dinocosta hi, please take a look again at your convenience

@peakxy peakxy force-pushed the fix-git-open-file-in-project branch from ad8da13 to 2ad4508 Compare July 11, 2026 10:50
@maxdeviant maxdeviant changed the title fix: "Open file in project" option in the right-click menu does not work Fix “Open file in project" option in the right-click menu not working Jul 11, 2026
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 first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When viewing changed files in the Git history, the "Open file in project" option in the right-click menu does not work.

2 participants