[BUG] Multi-root workspace: agent-emitted file links unclickable outside primary folder
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
This issue has been reported at: #50936 -- But the issue was closed, because it was "stale". Adding a label "stale" does not notify users.
When the agent emits a markdown link to a file located in any workspace folder OTHER than the primary one, no link format produces a clickable result. The system prompt instructs the agent to use markdown relative paths (e.g. [file.ts](src/file.ts#L42)), which only works for files under the primary workspace folder.
What Should Happen?
Expected
Either:
- (A) The relative-path resolver should search across all workspace folders, not just the primary.
- (B) The renderer should accept absolute filesystem paths (forward- or backslash) and rewrite them to
vscode://file/...:lineURIs at render time. - (C) The agent's system prompt should specify a link format known to work in multi-root workspaces, and the extension should support it.
Workaround
Currently the agent has to fall back to plain path:line text with no clickable link, forcing the user to copy/paste the path into Quick Open.
Impact
On every cross-folder file reference, the user has to manually navigate. In codebases composed of related repos opened side-by-side (monorepo-like setups), this is most file references.
Error Messages/Logs
Steps to Reproduce
Reproduction
- Open a multi-root workspace in VSCode where the primary folder is
apps/serverand an additional folder ispackages/plugin. - Ask the agent to reference a file in
packages/plugin/src/mcp.js. - The agent emits one of these formats — none click:
- Relative:
[mcp.js](src/mcp.js#L89)— resolved against primary folder, file not found - Windows absolute:
[mcp.js](e:\repo\packages\plugin\src\mcp.js)— invalid URL (backslashes) - Forward-slash absolute:
[mcp.js](e:/repo/packages/plugin/src/mcp.js)— non-standard, ignored - file:// URI:
[mcp.js](file:///e:/repo/packages/plugin/src/mcp.js)— does not click - vscode:// URI:
[mcp.js](vscode://file/e:/repo/packages/plugin/src/mcp.js:89)— does not click
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.145
Platform
Other
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Up
Similar issue on Mac where a multi-root workspace is used in VSCode. Claude-Code only recognizes index 0 or root_1 below as the project folder -
{
"folders": [
{
"path": "/Users/xxxx/.local/share/vip/dev-environment/root_1"
},
{
"path": "/Users/xxxx/sites/root_2"
}
],
....
The files or folders under /root_2/ are not indexed for @ suggestions.
Response from Claude-Code -
That's a Claude Code limitation — the @ file mention autocomplete only indexes the primary working directory (/Users/xxxx/.local/share/vip/dev-environment/root_1), not additional directories configured in the workspace.
The additional working directory (/Users/xxxx/sites/root_2 is accessible to me via tools (I can read/write files there), but it isn't included in the @ suggestion index.
Hi folks, It would be nice to have a look at this issue from time to time, if it is labelled: "stale". So it will be auto-closed soon. Add a comment so stale should go away ;)
An other issue, that I would have loved to be fixed got close because the conversation stopped. So from time to time, let's create some traffic, to let them know we wold love to "still" get it fixed ;)