Skip to content

Fix "Open in VS Code" not opening workspace for Claude agent sessions#312468

Merged
TylerLeonhardt merged 3 commits intomainfrom
copilot/fix-open-in-vs-code-issue
Apr 25, 2026
Merged

Fix "Open in VS Code" not opening workspace for Claude agent sessions#312468
TylerLeonhardt merged 3 commits intomainfrom
copilot/fix-open-in-vs-code-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

Clicking "Open in VS Code" from a Claude session opened the session but silently skipped opening the workspace folder. Copilot CLI sessions worked correctly because the folder URI extraction was explicitly gated on CopilotCLISessionType.id.

Changes

  • browser/openInVSCode.contribution.ts / electron-browser/openInVSCode.contribution.ts: Replace the session-type guard with the existing isWorkspaceAgentSessionType() helper, which already covers both 'copilotcli' and 'claude-code'.
// Before — Claude sessions always resolved to undefined
const rawFolderUri = activeSession.sessionType === CopilotCLISessionType.id
    ? repo?.workingDirectory ?? repo?.uri
    : undefined;

// After — both Copilot CLI and Claude Code sessions resolve their folder
const rawFolderUri = isWorkspaceAgentSessionType(activeSession.sessionType)
    ? repo?.workingDirectory ?? repo?.uri
    : undefined;

For Claude sessions, repo.uri is already URI.file(workingDirectoryPath), so workingDirectory ?? uri correctly resolves to the working directory for both session types.

Copilot AI requested review from Copilot and removed request for Copilot April 25, 2026 00:47
Copilot AI linked an issue Apr 25, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot April 25, 2026 00:51
Copilot AI changed the title [WIP] Fix 'Open in VS Code' action for Claude sessions Fix "Open in VS Code" not opening workspace for Claude agent sessions Apr 25, 2026
Copilot AI requested a review from TylerLeonhardt April 25, 2026 00:52
Copilot AI review requested due to automatic review settings April 25, 2026 06:17
@TylerLeonhardt TylerLeonhardt marked this pull request as ready for review April 25, 2026 06:17
@TylerLeonhardt TylerLeonhardt enabled auto-merge (squash) April 25, 2026 06:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the Agents window “Open in VS Code” action so that Claude Code sessions (in addition to Copilot CLI sessions) correctly open the associated workspace folder when launching VS Code.

Changes:

  • Switch folder-URI extraction guard from CopilotCLISessionType.id to isWorkspaceAgentSessionType(...) in both web and desktop implementations.
  • Add a focused unit test suite covering isWorkspaceAgentSessionType for Copilot CLI, Claude Code, cloud, unknown, and undefined inputs.
Show a summary per file
File Description
src/vs/sessions/contrib/chat/browser/openInVSCode.contribution.ts Uses isWorkspaceAgentSessionType to include Claude Code sessions when resolving the folder URI for “Open in VS Code”.
src/vs/sessions/contrib/chat/electron-browser/openInVSCode.contribution.ts Same session-type gating change for the desktop “Open in VS Code” action path (sibling app / protocol handler).
src/vs/sessions/services/sessions/test/common/session.test.ts Adds unit tests validating isWorkspaceAgentSessionType behavior across relevant session types.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

@TylerLeonhardt TylerLeonhardt merged commit e59d407 into main Apr 25, 2026
30 checks passed
@TylerLeonhardt TylerLeonhardt deleted the copilot/fix-open-in-vs-code-issue branch April 25, 2026 07:10
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Open in VS Code" from Claude agent does not open selected workspace

4 participants