diff --git a/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts b/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts index 28fb4787d24a103d47b097c7721a08b4a89ac0fe..9354baad05866dcef20f04ccad6e9b65a5918052 100644 --- a/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts +++ b/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts @@ -101,7 +101,7 @@ export class RemoteFileDialog { } public async showOpenDialog(options: IOpenDialogOptions = {}): Promise { - this.scheme = this.getScheme(options.availableFileSystems); + this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri); this.userHome = await this.getUserHome(); const newOptions = await this.getOptions(options); if (!newOptions) { @@ -112,7 +112,7 @@ export class RemoteFileDialog { } public async showSaveDialog(options: ISaveDialogOptions): Promise { - this.scheme = this.getScheme(options.availableFileSystems); + this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri); this.userHome = await this.getUserHome(); this.requiresTrailing = true; const newOptions = await this.getOptions(options, true); @@ -157,8 +157,14 @@ export class RemoteFileDialog { return resources.toLocalResource(URI.from({ scheme: this.scheme, path }), this.scheme === Schemas.file ? undefined : this.remoteAuthority); } - private getScheme(available: string[] | undefined): string { - return available ? available[0] : Schemas.file; + private getScheme(available: string[] | undefined, defaultUri: URI | undefined): string { + if (available) { + if (defaultUri && (available.indexOf(defaultUri.scheme) >= 0)) { + return defaultUri.scheme; + } + return available[0]; + } + return Schemas.file; } private async getRemoteAgentEnvironment(): Promise { @@ -215,7 +221,7 @@ export class RemoteFileDialog { this.filePickBox.autoFocusOnList = false; this.filePickBox.ignoreFocusOut = true; this.filePickBox.ok = true; - if (this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) { + if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) { this.filePickBox.customButton = true; this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local'); let action;