[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_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗