Skip to content

Open Workspace In Agents Window: select folder in new chat view#314602

Merged
sandy081 merged 1 commit into
mainfrom
sandy081/open-workspace-in-agents-window
May 6, 2026
Merged

Open Workspace In Agents Window: select folder in new chat view#314602
sandy081 merged 1 commit into
mainfrom
sandy081/open-workspace-in-agents-window

Conversation

@sandy081
Copy link
Copy Markdown
Member

@sandy081 sandy081 commented May 6, 2026

When "Open in Agents Window" is triggered from the workbench, pass the current workspace folder URI to the agents window and pre-select it in the new chat workspace picker.

Flow:

  • OpenWorkspaceInAgentsWindowAction passes the first workspace folder URI via openAgentsWindow({ folderUri })
  • Main process sends vscode:selectAgentsFolder IPC to the agents window
  • Sessions SelectAgentsFolderContribution handles the IPC:
    • Opens the new session view
    • Resolves the folder URI via session providers
    • Selects it in the NewChatViewPane workspace picker
    • If no provider is registered yet, waits for onDidChangeProviders with a timeout at LifecyclePhase.Eventually

When 'Open in Agents Window' is triggered from the workbench, pass
the current workspace folder URI to the agents window and pre-select
it in the new chat workspace picker.

Flow:
- Action passes folderUri via openAgentsWindow API
- Main process sends vscode:selectAgentsFolder IPC to agents window
- Sessions contribution resolves folder via providers and selects it
- Waits for provider registration with Eventually phase timeout

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 00:52
@sandy081 sandy081 enabled auto-merge (squash) May 6, 2026 00:52
@sandy081 sandy081 self-assigned this May 6, 2026
@sandy081 sandy081 added this to the 1.120.0 milestone May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Screenshot Changes

Base: c7bc16d4 Current: 2fe7abb4

Changed (12)

chat/input/chatInput/Default/Dark
Before After
before after
chat/input/chatInput/Default/Light
Before After
before after
chat/input/chatInput/WithArtifacts/Dark
Before After
before after
chat/input/chatInput/WithTodos/Light
Before After
before after
chat/input/chatInput/WithTodosAndFileChanges/Dark
Before After
before after
chat/input/chatInput/WithArtifactsAndFileChanges/Light
Before After
before after
chat/input/chatInput/Full/Dark
Before After
before after
chat/widget/chatWidget/SimpleQA/Light
Before After
before after
chat/widget/chatWidget/PendingToolApproval/Light
Before After
before after
chat/widget/chatWidget/MultiTurn/Light
Before After
before after
agentSessionsViewer/WithDiffChanges/Dark
Before After
before after
agentSessionsViewer/WithDiffChanges/Light
Before After
before after

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

This PR wires “Open in Agents Window” from the VS Code workbench through to the standalone Agents (Sessions) window so the current workspace folder can be preselected in the “New Session” workspace picker.

Changes:

  • Pass the first workbench workspace folder URI into INativeHostService.openAgentsWindow({ folderUri }).
  • Thread the folder URI through native main process window creation and send it to the Agents window via vscode:selectAgentsFolder IPC.
  • Add a Sessions workbench contribution that receives the IPC, opens the new-session view, resolves the URI via registered sessions providers, and selects it in NewChatViewPane.
Show a summary per file
File Description
src/vs/workbench/test/electron-browser/workbenchTestServices.ts Updates the test native host service stub to accept the new openAgentsWindow options shape.
src/vs/workbench/contrib/chat/electron-browser/agentSessions/agentSessionsActions.ts Passes the current workspace folder URI to openAgentsWindow.
src/vs/sessions/contrib/chat/electron-browser/chat.contribution.ts Adds IPC handler contribution to resolve/select the folder in the Sessions “New Session” picker.
src/vs/platform/windows/electron-main/windowsMainService.ts Extends openAgentsWindow to optionally send a folder-selection IPC after the window opens.
src/vs/platform/windows/electron-main/windows.ts Updates IWindowsMainService.openAgentsWindow signature to accept an optional folder URI.
src/vs/platform/native/electron-main/nativeHostMainService.ts Threads folderUri option from the native host RPC into windowsMainService.openAgentsWindow, and focuses the opened Agents window.
src/vs/platform/native/common/native.ts Extends the openAgentsWindow API to accept an optional { folderUri?: UriComponents }.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 2

Comment on lines +53 to +55
const workspaceContextService = accessor.get(IWorkspaceContextService);
const folderUri = workspaceContextService.getWorkspace().folders[0]?.uri;
await nativeHostService.openAgentsWindow({ folderUri });
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is fine for now — file:// is the expected case when triggering from the workbench. Remote workspace folders aren't the target scenario for this action. If remote support is needed later, we can map URIs at that point.

Comment thread src/vs/sessions/contrib/chat/electron-browser/chat.contribution.ts
@sandy081 sandy081 merged commit 5d6fc55 into main May 6, 2026
30 checks passed
@sandy081 sandy081 deleted the sandy081/open-workspace-in-agents-window branch May 6, 2026 01:10
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.

3 participants