提交 5a16d6e6 编写于 作者: A Alex Ross

Respect scheme of defaultUri in remote file picker

Fixes https://github.com/microsoft/vscode-remote-release/issues/1271
上级 02be1550
...@@ -101,7 +101,7 @@ export class RemoteFileDialog { ...@@ -101,7 +101,7 @@ export class RemoteFileDialog {
} }
public async showOpenDialog(options: IOpenDialogOptions = {}): Promise<URI | undefined> { public async showOpenDialog(options: IOpenDialogOptions = {}): Promise<URI | undefined> {
this.scheme = this.getScheme(options.availableFileSystems); this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri);
this.userHome = await this.getUserHome(); this.userHome = await this.getUserHome();
const newOptions = await this.getOptions(options); const newOptions = await this.getOptions(options);
if (!newOptions) { if (!newOptions) {
...@@ -112,7 +112,7 @@ export class RemoteFileDialog { ...@@ -112,7 +112,7 @@ export class RemoteFileDialog {
} }
public async showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined> { public async showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined> {
this.scheme = this.getScheme(options.availableFileSystems); this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri);
this.userHome = await this.getUserHome(); this.userHome = await this.getUserHome();
this.requiresTrailing = true; this.requiresTrailing = true;
const newOptions = await this.getOptions(options, true); const newOptions = await this.getOptions(options, true);
...@@ -157,8 +157,14 @@ export class RemoteFileDialog { ...@@ -157,8 +157,14 @@ export class RemoteFileDialog {
return resources.toLocalResource(URI.from({ scheme: this.scheme, path }), this.scheme === Schemas.file ? undefined : this.remoteAuthority); return resources.toLocalResource(URI.from({ scheme: this.scheme, path }), this.scheme === Schemas.file ? undefined : this.remoteAuthority);
} }
private getScheme(available: string[] | undefined): string { private getScheme(available: string[] | undefined, defaultUri: URI | undefined): string {
return available ? available[0] : Schemas.file; if (available) {
if (defaultUri && (available.indexOf(defaultUri.scheme) >= 0)) {
return defaultUri.scheme;
}
return available[0];
}
return Schemas.file;
} }
private async getRemoteAgentEnvironment(): Promise<IRemoteAgentEnvironment | null> { private async getRemoteAgentEnvironment(): Promise<IRemoteAgentEnvironment | null> {
...@@ -215,7 +221,7 @@ export class RemoteFileDialog { ...@@ -215,7 +221,7 @@ export class RemoteFileDialog {
this.filePickBox.autoFocusOnList = false; this.filePickBox.autoFocusOnList = false;
this.filePickBox.ignoreFocusOut = true; this.filePickBox.ignoreFocusOut = true;
this.filePickBox.ok = 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.customButton = true;
this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local'); this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local');
let action; let action;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册