VSCode Extension Regression: Multi-Root Workspace Context Not Switching Based on Active File Body: Environment
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?
The Claude Code VSCode extension has regressed in its handling of multi-root workspaces. Previously, opening a file from a different workspace folder would cause Claude Code to switch its working directory context to match that folder. This behavior no longer works in the latest extension version.
Current "Actual Behavior":
Claude Code sets its working directory to the first folder in the workspace instead of the folder containing the active file. The extension ignores which file is currently open and defaults to the first workspace folder
What Should Happen?
Claude Code's working directory should be set to the workspace folder containing the active file
(This is standard VSCode extension behavior using workspace.getWorkspaceFolder(uri) API)
Error Messages/Logs
N/A
Steps to Reproduce
- Open a multi-root VSCode workspace (.code-workspace file with multiple folders)
- Open a file from a project that is NOT the first folder in the explorer (e.g.,
void-driller/constants/worlds.jswhenlogis the first folder) - Start a new Claude Code session
- Ask Claude Code what directory it's working in
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.1 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
Workaround:
- Drag to reorder the folders in the explorer to make the desired project the first in the list
Impact:
- Multi-root workspaces are a core VSCode feature
- This regression makes the extension unintuitive for developers working with multi-root setups
7 Comments
I am having the same problem. In my case, it always chooses the first project. This used to work perfectly in v1. Please fix!
A workaround is to reorder the projects in the workspace as it seems to open the first one. Still a bug.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This still happens. I've been reordering the folders to work around it, which is not great.
Yes. Still happening
My current workaround is having a hook/CLAUDE.md that routes to the right project. So annoying.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.