Merge from vscode 2cd495805cf99b31b6926f08ff4348124b2cf73d

This commit is contained in:
ADS Merger
2020-06-30 04:40:21 +00:00
committed by AzureDataStudio
parent a8a7559229
commit 1388493cc1
602 changed files with 16375 additions and 12940 deletions

View File

@@ -25,6 +25,7 @@ import { coalesce } from 'vs/base/common/arrays';
import { trim } from 'vs/base/common/strings';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILabelService } from 'vs/platform/label/common/label';
import { isWindows } from 'vs/base/common/platform';
export abstract class AbstractFileDialogService implements IFileDialogService {
@@ -218,21 +219,17 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
}
private pickResource(options: IOpenDialogOptions): Promise<URI | undefined> {
const simpleFileDialog = this.createSimpleFileDialog();
const simpleFileDialog = this.instantiationService.createInstance(SimpleFileDialog);
return simpleFileDialog.showOpenDialog(options);
}
private saveRemoteResource(options: ISaveDialogOptions): Promise<URI | undefined> {
const remoteFileDialog = this.createSimpleFileDialog();
const remoteFileDialog = this.instantiationService.createInstance(SimpleFileDialog);
return remoteFileDialog.showSaveDialog(options);
}
protected createSimpleFileDialog(): SimpleFileDialog {
return this.instantiationService.createInstance(SimpleFileDialog);
}
protected getSchemeFilterForWindow(): string {
return !this.environmentService.configuration.remoteAuthority ? Schemas.file : REMOTE_HOST_SCHEME;
}
@@ -254,7 +251,7 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
const options: ISaveDialogOptions = {
defaultUri,
title: nls.localize('saveAsTitle', "Save As"),
availableFileSystems,
availableFileSystems
};
interface IFilter { name: string; extensions: string[]; }
@@ -282,8 +279,12 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
// We have no matching filter, e.g. because the language
// is unknown. We still add the extension to the list of
// filters though so that it can be picked
// (https://github.com/microsoft/vscode/issues/96283)
if (!matchingFilter && ext) {
// (https://github.com/microsoft/vscode/issues/96283) but
// only on Windows where this is an issue. Adding this to
// macOS would result in the following bugs:
// https://github.com/microsoft/vscode/issues/100614 and
// https://github.com/microsoft/vscode/issues/100241
if (isWindows && !matchingFilter && ext) {
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
}

View File

@@ -231,8 +231,8 @@ export class SimpleFileDialog {
return this.remoteAgentEnvironment;
}
protected async getUserHome(): Promise<URI> {
return (await this.pathService.userHome) ?? URI.from({ scheme: this.scheme, authority: this.remoteAuthority, path: '/' });
protected getUserHome(): Promise<URI> {
return this.pathService.userHome({ preferLocal: this.scheme === Schemas.file });
}
private async pickResource(isSave: boolean = false): Promise<URI | undefined> {