Skip to content

feat(source-control): add hover button to open a changed file for editing#920

Open
wang-mingxue wants to merge 1 commit into
crynta:mainfrom
wang-mingxue:feat/source-control-open-file
Open

feat(source-control): add hover button to open a changed file for editing#920
wang-mingxue wants to merge 1 commit into
crynta:mainfrom
wang-mingxue:feat/source-control-open-file

Conversation

@wang-mingxue

@wang-mingxue wang-mingxue commented Jul 2, 2026

Copy link
Copy Markdown

What

Add a one-click hover button on each changed-file row in the Source Control panel that opens the editable file (not the read-only diff).

Why

Clicking a changed file opens the read-only diff view. Opening the actual editable file was only reachable via the right-click → "Open File" context-menu item, which is easy to miss. This surfaces that same action as a visible hover control.

How

Reuses the existing onOpenFile handler already wired to the panel. The button renders on row hover next to the stage/discard controls (only for non-deleted files, matching the existing "Open File" menu-item guard). No change to the diff-click behavior or the context menu.

Testing

  • pnpm exec tsc --noEmit clean
  • Manual smoke-test: hovered a modified file, clicked the button, file opened in an editable editor tab; edited and saved with ⌘S. Deleted files correctly show no button. Diff-on-click and the context-menu "Open File" both still work.
  • Platforms tested: macOS

Screenshots / GIFs

Hover a changed file row → a file icon button appears beside the stage checkbox; clicking it opens the editable file.

Notes for reviewer

Tiny, focused change (one file, +13 lines). Pure discoverability win for an action that already existed in the context menu. Happy to adjust the icon or placement.

Summary by CodeRabbit

  • New Features
    • Added an inline “Open file for editing” action to changed file entries in source control.
    • The action appears only when a file can be opened and is hidden for deleted items.
    • The new control is integrated into each row with hover/focus visibility for a cleaner experience.

…ting

Clicking a changed file in the Source Control panel opens the read-only diff.
Opening the editable file was only reachable through the right-click "Open File"
context menu item, which is easy to miss. Surface it as a one-click hover action
on each file row (next to discard/stage), reusing the existing onOpenFile handler.

No behavior change to the diff click or the context menu.
@wang-mingxue wang-mingxue requested a review from crynta as a code owner July 2, 2026 06:03
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e2c9d94-2525-43af-92a1-7f37c9945ba3

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7f3e4 and c075661.

📒 Files selected for processing (1)
  • src/modules/source-control/SourceControlPanel.tsx

📝 Walkthrough

Walkthrough

Adds a new inline "Open file for editing" icon button to each row in SourceControlPanel's changed-file list. The button is conditionally rendered based on deletion state, path availability, and callback presence, using the newly imported File01Icon.

Changes

Open File Action

Layer / File(s) Summary
Row-level open file button
src/modules/source-control/SourceControlPanel.tsx
Imports File01Icon and adds a conditional IconActionButton in EntryRow that opens a file for editing when not deleted, onOpenFile is provided, and an absolute path exists, with hover/focus-driven visibility.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Related Issues: None specified

Related PRs: None specified

Suggested labels: ui, source-control

Suggested reviewers: None specified

Poem:
A rabbit hops through diff-lit trees,
One icon added, light as breeze,
"Open file," it softly says,
Hover close and it displays,
Thirteen lines, no code decays. 🐇

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the added hover action for opening changed files for editing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wang-mingxue

Copy link
Copy Markdown
Author

Heads-up per CONTRIBUTING: this wasn't pre-discussed in an issue/Discord. It's a small, self-contained discoverability tweak (one file, +13 lines) surfacing the existing "Open File" context-menu action as a hover button — so I opened it directly. If you'd rather align on direction first, happy to move the discussion to an issue or Discord, or close it. No worries either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant