diff --git a/src/vs/workbench/api/node/extHostApiCommands.ts b/src/vs/workbench/api/node/extHostApiCommands.ts index 56796b4f7c0..c270f87afd0 100644 --- a/src/vs/workbench/api/node/extHostApiCommands.ts +++ b/src/vs/workbench/api/node/extHostApiCommands.ts @@ -183,12 +183,12 @@ export class ExtHostApiCommands { ] }); - this._register('vscode.openFolder', (uri?: URI, newWindow?: boolean) => { + this._register('vscode.openFolder', (uri?: URI, forceNewWindow?: boolean) => { if (!uri) { - return this._commands.executeCommand('_workbench.ipc', 'vscode:openFolderPicker', [newWindow]); + return this._commands.executeCommand('_files.openFolderPicker', forceNewWindow); } - return this._commands.executeCommand('_workbench.ipc', 'vscode:windowOpen', [[uri.fsPath], newWindow]); + return this._commands.executeCommand('_workbench.ipc', 'vscode:windowOpen', [[uri.fsPath], forceNewWindow]); }, { description: 'Open a folder 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 unless the newWindow parameter is set to true.', args: [ diff --git a/src/vs/workbench/parts/files/electron-browser/files.electron.contribution.ts b/src/vs/workbench/parts/files/electron-browser/files.electron.contribution.ts index 09b6dbf8482..334f527af2b 100644 --- a/src/vs/workbench/parts/files/electron-browser/files.electron.contribution.ts +++ b/src/vs/workbench/parts/files/electron-browser/files.electron.contribution.ts @@ -19,6 +19,9 @@ import { DirtyFilesTracker } from 'vs/workbench/parts/files/electron-browser/dir import { OpenFolderAction, OpenFileAction, OpenFileFolderAction, ShowOpenedFileInNewWindow, GlobalRevealInOSAction, GlobalCopyPathAction, CopyPathAction, RevealInOSAction } from 'vs/workbench/parts/files/electron-browser/electronFileActions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { IWindowService } from 'vs/platform/windows/common/windows'; class FileViewerActionContributor extends ActionBarContributor { @@ -76,4 +79,10 @@ actionsRegistry.registerActionBarContributor(Scope.VIEWER, FileViewerActionContr // Register Dirty Files Tracker (Registry.as(WorkbenchExtensions.Workbench)).registerWorkbenchContribution( DirtyFilesTracker -); \ No newline at end of file +); + +// Register Commands +CommandsRegistry.registerCommand('_files.openFolderPicker', (accessor: ServicesAccessor, forceNewWindow: boolean) => { + const windowService = accessor.get(IWindowService); + windowService.openFolderPicker(forceNewWindow); +}); \ No newline at end of file