@@ -19,7 +19,7 @@ import { IViewContainersRegistry, IViewsRegistry, ViewContainerLocation, Extensi
1919import { Registry } from '../../../../platform/registry/common/platform.js' ;
2020import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js' ;
2121import { ISessionsManagementService } from '../../../services/sessions/common/sessionsManagement.js' ;
22- import { IsActiveSessionBackgroundProviderContext , IsNewChatInSessionContext , IsNewChatSessionContext , SessionsWelcomeVisibleContext } from '../../../common/contextkeys.js' ;
22+ import { IsNewChatInSessionContext , IsNewChatSessionContext , SessionsWelcomeVisibleContext } from '../../../common/contextkeys.js' ;
2323import { Menus } from '../../../browser/menus.js' ;
2424import { BranchChatSessionAction } from './branchChatSessionAction.js' ;
2525import { RunScriptContribution } from './runScriptAction.js' ;
@@ -58,7 +58,7 @@ export class OpenSessionWorktreeInVSCodeAction extends Action2 {
5858 id : OpenSessionWorktreeInVSCodeAction . ID ,
5959 title : localize2 ( 'openInVSCode' , 'Open in VS Code' ) ,
6060 icon : Codicon . vscodeInsiders ,
61- precondition : IsActiveSessionBackgroundProviderContext ,
61+ precondition : ContextKeyExpr . and ( IsAuxiliaryWindowContext . toNegated ( ) , SessionsWelcomeVisibleContext . toNegated ( ) ) ,
6262 menu : [ {
6363 id : Menus . TitleBarSessionMenu ,
6464 group : 'navigation' ,
@@ -78,8 +78,20 @@ export class OpenSessionWorktreeInVSCodeAction extends Action2 {
7878 const sessionsProvidersService = accessor . get ( ISessionsProvidersService ) ;
7979 const remoteAgentHostService = accessor . get ( IRemoteAgentHostService ) ;
8080
81+ const scheme = productService . quality === 'stable'
82+ ? 'vscode'
83+ : productService . quality === 'exploration'
84+ ? 'vscode-exploration'
85+ : productService . quality === 'insider'
86+ ? 'vscode-insiders'
87+ : productService . urlProtocol ;
88+
89+ const params = new URLSearchParams ( ) ;
90+ params . set ( 'windowId' , '_blank' ) ;
91+
8192 const activeSession = sessionsManagementService . activeSession . get ( ) ;
8293 if ( ! activeSession ) {
94+ await openerService . open ( URI . from ( { scheme, query : params . toString ( ) } ) , { openExternal : true } ) ; // Open VS Code without a specific path
8395 return ;
8496 }
8597
@@ -88,6 +100,7 @@ export class OpenSessionWorktreeInVSCodeAction extends Action2 {
88100 const rawFolderUri = activeSession . sessionType === CopilotCLISessionType . id ? repo ?. workingDirectory ?? repo ?. uri : undefined ;
89101
90102 if ( ! rawFolderUri ) {
103+ await openerService . open ( URI . from ( { scheme, query : params . toString ( ) } ) , { openExternal : true } ) ; // Open VS Code without a specific path
91104 return ;
92105 }
93106
@@ -98,16 +111,6 @@ export class OpenSessionWorktreeInVSCodeAction extends Action2 {
98111 const remoteAuthority = resolveRemoteAuthority (
99112 activeSession . providerId , sessionsProvidersService , remoteAgentHostService ) ;
100113
101- const scheme = productService . quality === 'stable'
102- ? 'vscode'
103- : productService . quality === 'exploration'
104- ? 'vscode-exploration'
105- : productService . quality === 'insider'
106- ? 'vscode-insiders'
107- : productService . urlProtocol ;
108-
109- const params = new URLSearchParams ( ) ;
110- params . set ( 'windowId' , '_blank' ) ;
111114 params . set ( 'session' , activeSession . resource . toString ( ) ) ;
112115
113116 if ( remoteAuthority ) {
0 commit comments