Merge from vscode 0a7364f00514c46c9caceece15e1f82f82e3712f

This commit is contained in:
ADS Merger
2020-07-22 03:06:57 +00:00
parent 53ec7585a9
commit 1b7b54ce14
229 changed files with 5099 additions and 3188 deletions

View File

@@ -25,7 +25,6 @@ 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 {
@@ -259,7 +258,7 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
// Build the file filter by using our known languages
const ext: string | undefined = defaultUri ? resources.extname(defaultUri) : undefined;
let matchingFilter: IFilter | undefined;
const filters: IFilter[] = coalesce(this.modeService.getRegisteredLanguageNames().map(languageName => {
const registeredLanguageFilters: IFilter[] = coalesce(this.modeService.getRegisteredLanguageNames().map(languageName => {
const extensions = this.modeService.getExtensions(languageName);
if (!extensions || !extensions.length) {
return null;
@@ -279,24 +278,20 @@ 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) 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) {
// (https://github.com/microsoft/vscode/issues/96283)
if (!matchingFilter && ext) {
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
}
// Order of filters is
// - File Extension Match
// - All Files
// - All Files (we MUST do this to fix macOS issue https://github.com/microsoft/vscode/issues/102713)
// - File Extension Match (if any)
// - All Languages
// - No Extension
options.filters = coalesce([
matchingFilter,
{ name: nls.localize('allFiles', "All Files"), extensions: ['*'] },
...filters,
matchingFilter,
...registeredLanguageFilters,
{ name: nls.localize('noExt', "No Extension"), extensions: [''] }
]);