Skip to content

fix(web): files panel right-click actions and drags use the folder's real path - #336

Merged
LoganRupe merged 1 commit into
LoganRupe:multi-repo-workspacesfrom
dotrahat:fix/335/files-panel-context-menu-paths
Oct 2, 2026
Merged

LoganRupe merged 1 commit into
LoganRupe:multi-repo-workspacesfrom
dotrahat:fix/335/files-panel-context-menu-paths

Conversation

@dotrahat

@dotrahat dotrahat commented Oct 2, 2026 •

Copy link
Copy Markdown

In a files panel with several folders, right-clicking a file or dragging it into the composer used the folder name shown in the tree as if it were a path in the workspace folder. For a listed folder outside the workspace folder, a nested listed folder, or an isolated run's worktree, the menu actions and the mention pointed at the wrong file. Details are in #335.

Fix

The right-click menu and drag-to-composer now resolve each entry through its real folder, the way left-click already does. A new fileTreeEntryTarget helper in filePath.ts turns a tree entry into its folder and path, and both use it through FileBrowserPanel. A top-level folder entry such as notes now means that folder itself.

Mentions from a multi-folder tree use the file's full path, as @ search already does for files in another folder. So Copy mention on api/README.md now gives /home/<user>/dev/scope-test-four/api/README.md rather than api/README.md. Single-folder projects are unchanged and still get relative mentions.

Testing

  • New unit tests cover a folder outside the workspace folder, a nested folder, a top-level folder entry and the single-folder case, plus a drag mention resolved by the host. All 129 tests in components/files and composerMentionDrag.test.ts pass, the web typecheck is clean, and lint reports the same warnings on the changed files as multi-repo-workspaces. I didn't run the full suite.
  • Tested in AppImages built from this branch, with the Files panel: right-click actions use the folder's display name, not its real path #335 example project. The right-click rows were tested on the first version of the commit; the drag rows and a re-check of Reveal in Files and Copy mention ran on the final one, after the right-click handler moved to the shared helper.
Action Result
ideas.md (in ../notes) → Reveal in Files Opens ~/dev/notes
ideas.md → Copy mention [ideas.md](/home/<user>/dev/notes/ideas.md)
ideas.md → Open with → VS Code Opens the real file
ideas.md → Add to chat, "What is the first line of this file?" The agent reads ~/dev/notes/ideas.md directly
plan.md (in notes/2026) → Reveal in Files / Copy mention Opens ~/dev/scope-test-four/notes/2026 / full path
The notes folder → Reveal in Files Opens ~/dev, the folder that contains it
api/README.md → Reveal in Files Opens ~/dev/scope-test-four/api, as before
Drag ideas.md, plan.md or the notes folder into the composer The mention has the full path
WORKTREE.md in an isolated run → Reveal in Files / Copy mention Opens the worktree's api folder / full worktree path
A file in a single-folder project → Copy mention, drag Relative path, as before

Fixes #335

Model: Claude Opus 5.5, harness: Claude Code.

…real path

In a multi-root files tree, a file's tree path starts with its root's label,
and the right-click menu joined that path to the workspace folder. That only
named the file when the root sat directly in the workspace folder under its
own name, so Reveal, Open, Open with, Copy mention and Add to chat pointed at
the wrong file for a listed folder outside the workspace folder, a nested
listed folder, or an isolated run's worktree. Dragging a row into the
composer built its mention from the same tree path.

Both now resolve each entry through its root, the way left-click does, and
mention it by full path, as @ search does for files in another root.

Fixes LoganRupe#335

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M labels Oct 2, 2026

@LoganRupe LoganRupe left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested against multi-repo-workspaces (feee30eed) with the #335 layout. Right-click ideas.md (from ../notes), Add to chat, then click the chip. Before, it fails with "Failed to read workspace file 'notes/ideas.md'". With this branch it opens ~/dev/notes/ideas.md. The 129 tests pass locally too. LGTM.

compare.mp4

@LoganRupe
LoganRupe merged commit 7e164c7 into LoganRupe:multi-repo-workspaces Oct 2, 2026
7 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 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