Skip to content

feat(web): copy names and paths, or add to chat, from file trees - #41588

Draft
antoniooo12 wants to merge 4 commits into
pingdotgg:mainfrom
antoniooo12:feat/diff-tree-copy-path-menu
Draft

antoniooo12 wants to merge 4 commits into
pingdotgg:mainfrom
antoniooo12:feat/diff-tree-copy-path-menu

Conversation

@antoniooo12

@antoniooo12 antoniooo12 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The file trees offer no way to copy a file's or folder's name or path. Right-clicking a row in the PR Code tab's file tree, or in the Diff panel's file tree, opens no file menu. In the Files panel, the right-click menu can copy a mention but not a path. To put a folder's path in a prompt, I type it, or copy a file path from a diff header and trim it.

To reproduce: open a pull request's Code tab, show the file tree and right-click a folder. No file menu opens. In the Files panel, right-click a folder: the menu has Open with, Copy mention and Add to chat, but no Copy path.

Expected: right-clicking a row in any of these trees offers Copy name and Copy path, as editors like WebStorm and VS Code do.

Change

Right-clicking a row in the Files panel, the PR Code tab's file tree or the Diff panel's file tree now offers Copy name and Copy path. The changed-files tree also gets the Files panel's Add to chat when a chat is open.

  • Trees: both Pierre trees open the same app menu through one helper, components/files/fileTreeRowMenu.ts. It captures the pointer before Pierre's shadow-DOM row handler, anchors Shift+F10 to the row and returns focus on Escape. The Files panel already had this logic; the changed-files tree is its second user, so it moved instead of being copied. Right-click focuses a row without selecting it, so the diff does not scroll.
  • Paths: in the changed-files tree, Copy path copies the path as the diff names it, the same value as the diff header's Copy path button. In the Files panel it copies the path the panel shows: workspace-relative, or absolute for a host folder. Both use Windows separators on a Windows host. A folder loses its trailing slash. A changed file that shares its path with a folder loses the invisible suffix the tree gives it.
  • Add to chat: the changed-files tree inserts the same composer mention as the Files panel, through the same helper and toasts. The mention names the file from the thread's folder, resolved the way the Diff panel already opens files, so it stays right when the thread works below the repository root. In the PR Code tab it is offered only when the thread is checked out from the pull request's repository. It is hidden where the thread cannot name the file: no composer, a pull request page outside a thread, a repository outside the thread's folder, or an unknown repository root.
  • Copy: "Copy path", "Add to chat" and their error toasts reuse existing strings. "Copy name" and "Failed to copy name" are translated in every web locale.

Copying runs on the client and needs no shell action, so remote and tunnel environments work unchanged. Mobile is untouched: its files screen already has Copy path, and it has no changed-files tree.

Scope

This is a feature, not a bug fix, and no maintainer has asked for it. It covers the Ideas discussion #31525 (Copy path in the Files panel menu) and applies the same menu to the changed-files tree. I am not in VOUCHED.td. I opened it as a draft so a maintainer can decide whether it fits; I will close it if it does not.

All changes serve one problem: the file trees cannot hand a row's name or path to the chat. Add to chat in the changed-files tree reuses the Files panel's action for the same purpose.

Not included: a full (absolute) path in the PR Code tab. The project folder can sit below the repository root, and the PR head may not be checked out, so an absolute path could name a file that is not there.

Verification

I found this while reviewing pull requests in the Code tab, where I wanted to put a folder's path in a prompt.

Tests. New browser tests in DiffFileTree.browser.test.tsx and FileBrowserPanel.browser.test.tsx, and a logic test in diffFileTree.logic.test.ts. They fail on these mutations:

  • DiffFileTree.tsx reverted to main: no menu item to click.
  • FileBrowserPanel.tsx reverted to main: no Copy path item.
  • A folder's trailing slash kept in the changed-files tree: Copy path gives apps/web/src/ instead of apps/web/src.
  • A host folder's Copy path made relative: src instead of /repo/src.
  • Add to chat shown with no open chat, or removed.

The existing Files panel tests, including the Shift+F10 and Escape focus test, pass with the moved helper. vp run check:changed and vp run i18n:check pass.

Real app. Scenarios with the Replay agent ran the web app on main and on this branch. On this branch, right-clicking the docs folder in the Files panel and the flattened packages / app / src row in the Diff panel's tree, then choosing Copy path and pasting into the composer, gives docs and packages/app/src. On main the Files panel menu has no copy items, and the changed-files tree opens no menu.

Before (main) After
Files panel Files panel menu on main Files panel menu with Copy name and Copy path
Changed files Right-click on a changed-files row opens no menu on main Changed-files menu with Copy name, Copy path and Add to chat

Recording (64 s, captioned, this branch): in the Files panel and then in the changed-files tree, it copies a folder path and a file name, pastes each into the composer with Ctrl+V, then uses Add to chat. Video

Not checked:

  • The PR Code tab in a running app: the test environment had no source control host access. It uses the same tree component, and its existing browser tests pass.
  • Add to chat in a running app with the thread folder below the repository root. That path comes from resolveDiffPathForWorkspace, which has tests for nested projects.
  • The desktop app's native menu and Windows hosts: I ran the web app in Chromium on Linux.

Written by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running in T3 Code. Reviewed by Claude Fable 5.2 (claude-fable-5-2).

🤖 Generated with Claude Code

antoniooo12 and others added 4 commits November 23, 2026 20:21
…tree

Right-clicking a row in the changed-files tree of the PR Code tab and the Diff panel offers Copy name and Copy path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Files panel menu gets the same Copy name and Copy path items; both trees share the right-click anchor and copy helpers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changed-files tree menu offers Add to chat when a chat is open, sharing the Files panel's mention insert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Diff panel and the PR Code tab pass a thread-relative path, and the item is hidden where the thread cannot name the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 23, 2026

This branch has not been deployed

No deployments
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 Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant