mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 02:58:31 -05:00
Merge from vscode 0a7364f00514c46c9caceece15e1f82f82e3712f
This commit is contained in:
@@ -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: [''] }
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user