Repository navigation
feat(web): copy names and paths, or add to chat, from file trees - #41588
Draft
antoniooo12 wants to merge 4 commits into
Draft
antoniooo12 wants to merge 4 commits into
antoniooo12 wants to merge 4 commits into
Conversation
…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>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.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.tsxandFileBrowserPanel.browser.test.tsx, and a logic test indiffFileTree.logic.test.ts. They fail on these mutations:DiffFileTree.tsxreverted tomain: no menu item to click.FileBrowserPanel.tsxreverted tomain: no Copy path item.apps/web/src/instead ofapps/web/src.srcinstead of/repo/src.The existing Files panel tests, including the Shift+F10 and Escape focus test, pass with the moved helper.
vp run check:changedandvp run i18n:checkpass.Real app. Scenarios with the Replay agent ran the web app on
mainand on this branch. On this branch, right-clicking thedocsfolder in the Files panel and the flattenedpackages / app / srcrow in the Diff panel's tree, then choosing Copy path and pasting into the composer, givesdocsandpackages/app/src. Onmainthe Files panel menu has no copy items, and the changed-files tree opens no menu.main)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:
resolveDiffPathForWorkspace, which has tests for nested projects.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