@@ -20,7 +20,7 @@ import { ILanguageService } from '../../../editor/common/languages/language.js';
20
20
import { IFileDialogService , IPickAndOpenOptions } from '../../../platform/dialogs/common/dialogs.js' ;
21
21
import { URI , UriComponents } from '../../../base/common/uri.js' ;
22
22
import { Schemas } from '../../../base/common/network.js' ;
23
- import { IOpenEmptyWindowOptions , IOpenWindowOptions , IWindowOpenable } from '../../../platform/window/common/window.js' ;
23
+ import { IFileToOpen , IFolderToOpen , IOpenEmptyWindowOptions , IOpenWindowOptions , IWorkspaceToOpen } from '../../../platform/window/common/window.js' ;
24
24
import { IRecent , IWorkspacesService } from '../../../platform/workspaces/common/workspaces.js' ;
25
25
import { IPathService } from '../../services/path/common/pathService.js' ;
26
26
import { ILocalizedString } from '../../../platform/action/common/action.js' ;
@@ -160,6 +160,7 @@ interface IOpenFolderAPICommandOptions {
160
160
forceLocalWindow ?: boolean ;
161
161
forceProfile ?: string ;
162
162
forceTempProfile ?: boolean ;
163
+ filesToOpen ?: UriComponents [ ] ;
163
164
}
164
165
165
166
CommandsRegistry . registerCommand ( {
@@ -197,8 +198,9 @@ CommandsRegistry.registerCommand({
197
198
forceTempProfile : arg ?. forceTempProfile ,
198
199
} ;
199
200
200
- const uriToOpen : IWindowOpenable = ( hasWorkspaceFileExtension ( uri ) || uri . scheme === Schemas . untitled ) ? { workspaceUri : uri } : { folderUri : uri } ;
201
- return commandService . executeCommand ( '_files.windowOpen' , [ uriToOpen ] , options ) ;
201
+ const workspaceToOpen : IWorkspaceToOpen | IFolderToOpen = ( hasWorkspaceFileExtension ( uri ) || uri . scheme === Schemas . untitled ) ? { workspaceUri : uri } : { folderUri : uri } ;
202
+ const filesToOpen : IFileToOpen [ ] = typeof arg === 'object' ? arg . filesToOpen ?. map ( file => ( { fileUri : URI . from ( file , true ) } ) ) ?? [ ] : [ ] ;
203
+ return commandService . executeCommand ( '_files.windowOpen' , [ workspaceToOpen , ...filesToOpen ] , options ) ;
202
204
} ,
203
205
metadata : {
204
206
description : 'Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.' ,
@@ -213,6 +215,10 @@ CommandsRegistry.registerCommand({
213
215
'`forceNewWindow`: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. ' +
214
216
'`forceReuseWindow`: Whether to force opening the folder/workspace in the same window. Defaults to false. ' +
215
217
'`noRecentEntry`: Whether the opened URI will appear in the \'Open Recent\' list. Defaults to false. ' +
218
+ '`forceLocalWindow`: Whether to force opening the folder/workspace in a local window. Defaults to false. ' +
219
+ '`forceProfile`: The profile to use when opening the folder/workspace. Defaults to the current profile. ' +
220
+ '`forceTempProfile`: Whether to use a temporary profile when opening the folder/workspace. Defaults to false. ' +
221
+ '`filesToOpen`: An array of files to open in the new window. Defaults to an empty array. ' +
216
222
'Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.' ,
217
223
constraint : ( value : any ) => value === undefined || typeof value === 'object' || typeof value === 'boolean'
218
224
}
0 commit comments