Skip to content

Files panel: right-click actions use the folder's display name, not its real path #335

Closed

Description

@dotrahat

When the files panel shows several folders, right-clicking a file builds its path from the folder name shown in the tree, joined to the workspace folder. That only works when the folder sits directly in the workspace folder under that name. For any other folder, every action in the menu points at the wrong file. Left-clicking the same file opens the right one.

Found while retesting the #323 follow-ups on feee30eed.

Example

~/dev/scope-test-four/
  scope-test-four.code-workspace   folders: api, web, notes/2026, ../notes
  api/          git
  web/          git
  notes/2026/   shown as 2026
    plan.md
~/dev/notes/    shown as notes
  ideas.md
Right-click → action Result
ideas.md → Reveal in Files Opens ~/dev/scope-test-four/notes, which has no ideas.md
ideas.md → Open with → VS Code Opens a new, empty ideas.md
ideas.md → Copy mention [ideas.md](notes/ideas.md)
ideas.md → Add to chat Claude wasn't sure which ideas.md was meant. It read ~/dev/scope-test-four/notes/ideas.md first, then found ~/dev/notes/ideas.md
plan.md → Reveal in Files Nothing happens, and no error shows
plan.md → Copy mention [plan.md](2026/plan.md)

The same happens in an isolated run of scope-test for api → WORKTREE.md, a file that only exists in the worktree: Reveal in Files does nothing, and Copy mention gives [WORKTREE.md](api/WORKTREE.md).

Why

In a tree with several folders, each file's tree path starts with its folder's display name, like notes/ideas.md. The right-click menu joins that path to the workspace folder (apps/web/src/components/files/FileBrowserPanel.tsx:256-264):

const relativePath = item.path.replace(/\/$/, "");
const mention = serializeComposerFileLink(relativePath);
// ...
const fileTarget = { environmentId, filePath: relativePath, workspaceRoot: cwd };

Left-click doesn't have the problem because it looks the file up in entryInfo, which keeps the real folder and the path inside it (FileBrowserPanel.tsx:367-369).

From the code, a repo outside the workspace folder is affected the same way, so this predates #325.

Suggested fix

Build the menu's target from entryInfo, the way left-click does, and give the mention the file's full path, as @ search already does for files in another folder (apps/web/src/components/chat/ChatComposer.tsx:3614-3616).

Activity

  1. added a commit that references this issue on Oct 2, 2026
    7e164c7
  2. dotrahat commented on Oct 2, 2026

    @dotrahat
    Author

    @LoganRupe Copilot flagged one remaining case on #337 after it was closed, and #336 has it too. When two listed folders share a name, their labels get a parent segment (dupe-a/docs). The tree then shows a dupe-a row that only groups them. Right-click and drag on that row point at a path that doesn't exist: <workspace>/dupe-a, or <docs folder>/dupe-a during a search. It's a narrow edge case. I have a small fix parked if you want it.

  3. LoganRupe commented on Oct 2, 2026

    @LoganRupe
    Owner

    @LoganRupe Copilot flagged one remaining case on #337 after it was closed, and #336 has it too. When two listed folders share a name, their labels get a parent segment (dupe-a/docs). The tree then shows a dupe-a row that only groups them. Right-click and drag on that row point at a path that doesn't exist: <workspace>/dupe-a, or <docs folder>/dupe-a during a search. It's a narrow edge case. I have a small fix parked if you want it.

    Yes please 🙏

  4. LoganRupe commented on Oct 6, 2026

    @LoganRupe
    Owner

    Heads-up @dotrahat: in a few days multi-repo-workspaces moves to Tr1Fecta's rewrite on orchestrator v2 (#338), with the outside-folders work on top. The files panel changes from #323 and #336 aren't on that branch yet, so your parked fix would only apply to the old code. That code stays as multi-repo-workspaces-pre-v2. If you still want to send the fix, target that branch. Otherwise I'll close this issue when the switch happens.

  5. LoganRupe commented on Oct 7, 2026

    @LoganRupe
    Owner

    Closing this now that #336 and #339 are both merged into multi-repo-workspaces. #336 fixed the original bug: right-click and drag now resolve each folder's real path instead of its display name. #339 fixed the remaining edge case of the dupe-a row that groups same-named folders.

    Thanks @dotrahat for the detailed report, and for following up on the grouped-row case after #337 closed.

    One heads-up: #338 hasn't merged yet, so both fixes are on the current code. When multi-repo-workspaces moves to the orchestrator v2 rewrite, this code stays on multi-repo-workspaces-pre-v2. If the v2 files panel turns out to have the same issue, that gets a new issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions