Converge addFileSchema implementation

This commit is contained in:
Alex Ross 2021-06-28 14:44:15 +02:00
parent 01b0b055d0
commit 7441f553c4
No known key found for this signature in database
GPG key ID: 89DDDBA66CBA7840
3 changed files with 3 additions and 11 deletions

View file

@ -145,7 +145,9 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
}
}
protected abstract addFileSchemaIfNeeded(schema: string): string[];
protected addFileSchemaIfNeeded(schema: string): string[] {
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
}
protected async pickFileFolderAndOpenSimplified(schema: string, options: IPickAndOpenOptions, preferNewWindow: boolean): Promise<any> {
const title = nls.localize('openFileOrFolder.title', 'Open File Or Folder');

View file

@ -130,10 +130,6 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
return [uri];
}
protected addFileSchemaIfNeeded(schema: string): string[] {
return schema === Schemas.untitled ? [Schemas.file] : [schema];
}
private shouldUseSimplified(scheme: string): boolean {
return ![Schemas.file, Schemas.userData, Schemas.tmp].includes(scheme);
}

View file

@ -187,12 +187,6 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
const result = await this.nativeHostService.showOpenDialog(newOptions);
return result && Array.isArray(result.filePaths) && result.filePaths.length > 0 ? result.filePaths.map(URI.file) : undefined;
}
protected addFileSchemaIfNeeded(schema: string): string[] {
// Include File schema unless the schema is web
// Don't allow untitled schema through.
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
}
}
registerSingleton(IFileDialogService, FileDialogService, true);