Skip to content

feat: add copy path button to diff headers#2403

Open
ipanasenko wants to merge 16 commits into
pingdotgg:mainfrom
ipanasenko:t3code/853b397b
Open

feat: add copy path button to diff headers#2403
ipanasenko wants to merge 16 commits into
pingdotgg:mainfrom
ipanasenko:t3code/853b397b

Conversation

@ipanasenko

@ipanasenko ipanasenko commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

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.

SCR-20260429-mizf-2 image

Summary

  • add a copy-path button to diff file headers using the Diffs renderHeaderMetadata slot

Note

Add copy path button to diff file headers

  • Adds a DiffFilePathCopyButton component that copies a file path to the clipboard, toggling between Copy and Check icons and updating its tooltip to reflect copy state.
  • Integrates the button into DiffPanel by passing it as renderHeaderMetadata to AnnotatableCodeView, which renders it in the header of each file diff.
  • Extracts shared anchored toast helpers (showAnchoredCopySuccessToast, showAnchoredCopyErrorToast, ANCHORED_COPY_TOAST_TIMEOUT_MS) into anchoredCopyToast.ts and updates MessageCopyButton to use them.

Macroscope summarized d701d82.


Note

Low Risk
Small UI-only change with clipboard feedback; no auth, data, or API impact.

Overview
Adds a copy path control on each diff file header so users can copy the resolved file path in one click (GitHub-style), with tooltip feedback and anchored success/error toasts.

AnnotatableCodeView gains a required renderHeaderMetadata callback that is forwarded to Pierre Diffs’ CodeView header slot; DiffPanel supplies DiffFilePathCopyButton with resolveFileDiffPath(fileDiff). Anchored copy toast behavior is centralized in anchoredCopyToast.ts, and MessageCopyButton is updated to use those helpers instead of inline toast code.

Reviewed by Cursor Bugbot for commit d701d82. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Apr 29, 2026
@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4ac8f56e-2098-4139-b171-d1783943ec13

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@ipanasenko ipanasenko changed the title Add copy path button to diff headers feat: add copy path button to diff headers Apr 29, 2026
@ipanasenko ipanasenko marked this pull request as ready for review April 29, 2026 12:03
Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Simple UI addition that adds a copy-path button to diff headers. Uses existing hooks and components, with a clean refactor of duplicate toast logic into a shared utility. Self-contained with no complex runtime behavior changes.

You can customize Macroscope's approvability policy. Learn more.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Apr 29, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 18, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review June 18, 2026 16:03

Dismissing prior approval to re-evaluate b028ddf

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 18, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

I'd left align them after the path, like Github:

CleanShot 2026-06-18 at 20 41 37@2x

@ipanasenko

Copy link
Copy Markdown
Contributor Author

From what I see, to achieve this we'd need to use renderCustomHeader prop, and construct whole header manually. Are you okay with that?
Or am I missing something in diffs docs? 👀

@macroscopeapp macroscopeapp Bot dismissed their stale review June 21, 2026 18:27

Dismissing prior approval to re-evaluate a29ebac

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 21, 2026
# Conflicts:
#	apps/web/src/components/diffs/AnnotatableCodeView.tsx
@macroscopeapp macroscopeapp Bot dismissed their stale review June 22, 2026 10:47

Dismissing prior approval to re-evaluate d701d82

@juliusmarminge

Copy link
Copy Markdown
Member

you can patch in a slot for it? they'll add it soon:

image

@juliusmarminge

Copy link
Copy Markdown
Member

nvm should already exist:
CleanShot 2026-06-22 at 09 44 35@2x

@ipanasenko

Copy link
Copy Markdown
Contributor Author

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.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants