File/Folder picker (fixes #530)

This commit is contained in:
Benjamin Pasero
2016-04-07 15:51:26 +02:00
parent 6b3f6a2f29
commit 7d7028d458
3 changed files with 41 additions and 26 deletions

View File

@@ -163,10 +163,16 @@ class ExtHostApiCommands {
]
});
this._register('vscode.openFolder', (uri: URI, newWindow?: boolean) => this._commands.executeCommand('_workbench.ipc', 'vscode:windowOpen', [[uri.fsPath], newWindow]), {
description: 'Open a folder in the current window. Note that this will shutdown the current extension host process and start a new one on the given folder unless the newWindow parameter is set to true.',
this._register('vscode.openFolder', (uri?: URI, newWindow?: boolean) => {
if (!uri) {
return this._commands.executeCommand('_workbench.ipc', 'vscode:openFolderPicker', [newWindow]);
}
return this._commands.executeCommand('_workbench.ipc', 'vscode:windowOpen', [[uri.fsPath], newWindow]);
}, {
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: [
{ name: 'uri', description: 'Uri of the folder to open.', constraint: URI },
{ name: 'uri', description: '(optional) Uri of the folder to open. If not provided, a native dialog will ask the user for the folder' },
{ name: 'newWindow', description: '(optional) Wether to open the folder in a new window or the same. Defaults to opening in the same window.' }
]
});