feat: add copy path button to diff headers#2403
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: Approved Small UI feature adding a copy path button to diff headers. The implementation reuses existing clipboard and toast patterns, with clean extraction of shared toast utilities. The dependency bump is a minor beta version update. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate b028ddf
|
From what I see, to achieve this we'd need to use |
…53b397b # Conflicts: # apps/web/src/components/DiffPanel.tsx
Dismissing prior approval to re-evaluate a29ebac
# Conflicts: # apps/web/src/components/diffs/AnnotatableCodeView.tsx
Dismissing prior approval to re-evaluate d701d82
|
So, metadata slot is exactly what I used, and it rendered copy button at the very end 🤷♂️ Need something like postfix/suffix slot to be able to place button right after the path. |
|
👀 pierrecomputer/pierre#874 |
Dismissing prior approval to re-evaluate 1324094
|
@juliusmarminge I've bumped |



Hey guys!
I find myself in a need to copy a file path from diff view quite often. I use it to paste into the chat and ask questions about this specific file. I think it makes it much more obvious for model (and for me) what file we are talking about.
Currently the best workflow in T3 Code I found for copying file path is to manually select file path and do Cmd+C. I think this can be improved by adding a copy button, GitHub-style.
Summary
renderHeaderMetadataslotNote
Add copy path button to diff file headers
DiffFilePathCopyButtoncomponent that copies a file path to the clipboard and shows an anchored toast near the button for success or error states.AnnotatableCodeViewwith arenderHeaderFilenameSuffixcallback and wires it up inDiffPanelto render the copy button in each diff header.MessageCopyButtonto use the shared utilities.@pierre/diffsfrom1.3.0-beta.5to1.3.0-beta.7; the updated patch removes forced overrides ofenableGutterUtility,enableLineSelection, andlineHoverHighlight, so the editor now respects consumer-provided values for these options.Macroscope summarized c7dcbe0.
Note
Medium Risk
Touches the patched diff viewer’s gutter/line-selection behavior via a dependency bump; regressions could affect review comments or diff editing, though changes are localized to copy UI and option passthrough.
Overview
Adds a GitHub-style copy path control on each diff file header so users can paste paths into chat without manually selecting text.
Introduces
DiffFilePathCopyButtonand threads it throughAnnotatableCodeViewvia a new requiredrenderHeaderFilenameSuffixprop;DiffPanelsupplies the button withresolveFileDiffPath. Copy feedback uses shared anchored toasts inanchoredCopyToast.ts, andMessageCopyButtonis refactored to use the same helpers.Upgrades
@pierre/diffsto 1.3.0-beta.7 with an updated patch: the editor no longer forcesenableGutterUtility/enableLineSelectionoff, and gutterpointerdownbails when line selection is enabled—so review comment line selection keeps working alongside the new header slot.Reviewed by Cursor Bugbot for commit c7dcbe0. Bugbot is set up for automated code reviews on this repo. Configure here.