[BUG] IDE connection only works in VSCode's open folder directory, fails in subdirectories (v2.0.74)
Description
After upgrading to v2.0.74, Claude Code IDE connection only works when running claude in the exact directory that VSCode opened. Running claude in any subdirectory shows the extension is installed but fails to connect.
Environment
- Claude Code version: 2.0.74
- OS: Windows 11
- IDE: VSCode / Cursor
- Terminal: Integrated terminal
Steps to Reproduce
- Open VSCode/Cursor at
~/projects(parent folder) - Run
claudein~/projects→ IDE connects successfully -
cdinto a subdirectory~/projects/some-project - Run
claude→ IDE extension shows installed but cannot connect
Expected Behavior
IDE connection should work in subdirectories of the opened workspace folder.
Actual Behavior
IDE connection only works in the exact directory VSCode opened. Subdirectories fail to connect.
Lock File Analysis
The lock file at ~/.claude/ide/*.lock shows:
{"workspaceFolders":["c:\Users\...\projects"]}
Only the root folder is registered. When running claude in a subdirectory, path matching fails.
Workaround
Downgrade to v2.0.72 where this worked correctly.
Possibly Related
This may be a regression. Previously subdirectory matching worked.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/8559
- https://github.com/anthropics/claude-code/issues/12808
- https://github.com/anthropics/claude-code/issues/1411
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Update: After further testing, this is not a regression in v2.0.74. The same behavior exists in v2.0.72.
Clarification
This is actually a feature request rather than a bug.
Current behavior: IDE connection only works when cwd exactly matches one of the workspaceFolders in the lock file.
Expected behavior: IDE connection should work in subdirectories of any workspace folder.
Use Case
- Open VSCode at
~/projects(parent folder containing multiple repos) - Can browse/edit all repos' code in one window
- Open terminal,
cdinto~/projects/repo-a, runclaude -
Expected: IDE connects (since
repo-ais a subdirectory of workspace~/projects) - Actual: IDE shows "Installed VS Code extension" but doesn't connect
Suggested Fix
When checking if cwd matches a workspace folder, also check if cwd is a subdirectory of any workspace folder:
// Current: exact match only
workspaceFolders.includes(cwd)
// Suggested: also match subdirectories
workspaceFolders.some(folder => cwd.startsWith(folder))
This would support the common workflow of opening a parent folder in VSCode and working on multiple projects within it.
Additional finding: Manually modifying the lock file does NOT work as a workaround.
What I tried
- Added all subdirectories to
workspaceFoldersin~/.claude/ide/*.lock - Fixed case sensitivity (changed
c:\toC:\)
Result
-
/idecommand shows "Connected to Visual Studio Code" ✓ -
/statusstill shows "IDE: Installed VS Code extension" (not connected) - IDE features don't actually work - e.g., Edit tool doesn't trigger diff view in VSCode
Conclusion
The connection validation happens on both sides:
- CLI side: checks lock file (can be fooled by manual edit)
- Extension side: has its own validation that we can't bypass
This needs to be fixed in the extension itself to support subdirectory matching, not just the CLI.
Important update: This appears to be a regression, not a new feature request.
Evidence
Previously (possibly around v1.0.x or earlier v2.0.x), the following workflow worked:
- Open VSCode at parent folder
~/cursor-projects -
cdinto subdirectory~/cursor-projects/nexus(which has its own.venv) - Run
claude - IDE connection worked - diff view appeared when editing files
Now with v2.0.72, the same workflow fails - IDE shows "Installed" but doesn't connect, no diff view.
Request
Please investigate if subdirectory matching was removed/broken in a recent version. This is a common workflow for developers working on multiple projects from a single VSCode window.
Update: Multi-root Workspace + Case Sensitivity Issue
I tried using a multi-root workspace as a workaround. This successfully adds all subdirectories to the lock file's :
However, IDE connection still fails due to case sensitivity mismatch:
| Source | Path |
|---|---|
| Lock file | \ (lowercase ) |
| CLI cwd | \ (uppercase ) |
On Windows, path comparison should be case-insensitive, but the CLI's matching logic appears to be case-sensitive, causing the mismatch.
Conclusion: Even with multi-root workspace providing the correct , the case sensitivity bug prevents IDE connection from working in subdirectories.
Update: Extension-side validation confirmed
After fixing the case sensitivity in the lock file (changing c:\), running /ide` now reports "Connected to Visual Studio Code".
However, /status still shows "IDE: Installed VS Code extension" instead of "IDE: Connected to VS Code extension".
This confirms that validation happens on BOTH sides:
- CLI side: path matching against lock file (can be worked around by modifying lock file)
- Extension side: validates the connection request (cannot be bypassed)
The extension is rejecting connections from subdirectories even when they are listed in the multi-root workspace's workspaceFolders.
Root cause: The extension's validation logic doesn't properly handle subdirectory matching, even with multi-root workspaces.