Merge from vscode e5834d3280fcd04898efeac32b9cf1b893f9b127 (#9385)

* Merge from vscode e5834d3280fcd04898efeac32b9cf1b893f9b127

* distro
This commit is contained in:
Anthony Dresser
2020-02-28 00:37:06 -08:00
committed by GitHub
parent 70851716f7
commit 5d13ebf0d2
143 changed files with 1711 additions and 934 deletions

View File

@@ -92,6 +92,10 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
return ConfirmResult.DONT_SAVE; // no veto when we are in extension dev mode because we cannot assume we run interactive (e.g. tests)
}
return this.doShowSaveConfirm(fileNamesOrResources);
}
protected async doShowSaveConfirm(fileNamesOrResources: (string | URI)[]): Promise<ConfirmResult> {
if (fileNamesOrResources.length === 0) {
return ConfirmResult.DONT_SAVE;
}

View File

@@ -156,7 +156,7 @@ export class SimpleFileDialog {
public async showOpenDialog(options: IOpenDialogOptions = {}): Promise<URI | undefined> {
this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri);
this.userHome = await this.remotePathService.userHome;
this.userHome = await this.getUserHome();
const newOptions = this.getOptions(options);
if (!newOptions) {
return Promise.resolve(undefined);
@@ -167,7 +167,7 @@ export class SimpleFileDialog {
public async showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined> {
this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri);
this.userHome = await this.remotePathService.userHome;
this.userHome = await this.getUserHome();
this.requiresTrailing = true;
const newOptions = this.getOptions(options, true);
if (!newOptions) {
@@ -231,6 +231,13 @@ export class SimpleFileDialog {
return this.remoteAgentEnvironment;
}
private async getUserHome(): Promise<URI> {
if (this.scheme !== Schemas.file) {
return this.remotePathService.userHome;
}
return URI.from({ scheme: this.scheme, path: this.environmentService.userHome });
}
private async pickResource(isSave: boolean = false): Promise<URI | undefined> {
this.allowFolderSelection = !!this.options.canSelectFolders;
this.allowFileSelection = !!this.options.canSelectFiles;

View File

@@ -198,7 +198,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
}
}
return super.showSaveConfirm(fileNamesOrResources);
return super.doShowSaveConfirm(fileNamesOrResources);
}
}