Skip to content

Commit 6141623

Browse files
author
Benjamin Pasero
committed
Missing saveAs csv file type in file saveAs dialog (fix microsoft#96283)
1 parent e88b8d3 commit 6141623

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,25 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
279279
return filter;
280280
}));
281281

282-
// Filters are a bit weird on Windows, based on having a match or not:
283-
// Match: we put the matching filter first so that it shows up selected and the all files last
284-
// No match: we put the all files filter first
285-
const allFilesFilter = { name: nls.localize('allFiles', "All Files"), extensions: ['*'] };
286-
if (matchingFilter) {
287-
filters.unshift(matchingFilter);
288-
filters.unshift(allFilesFilter);
289-
} else {
290-
filters.unshift(allFilesFilter);
282+
// We have no matching filter, e.g. because the language
283+
// is unknown. We still add the extension to the list of
284+
// filters though so that it can be picked
285+
// (https://github.com/microsoft/vscode/issues/96283)
286+
if (!matchingFilter && ext) {
287+
matchingFilter = { name: nls.localize('fileExt', "{0} File", ext), extensions: [trim(ext, '.')] };
291288
}
292289

293-
// Allow to save file without extension
294-
filters.push({ name: nls.localize('noExt', "No Extension"), extensions: [''] });
295-
296-
options.filters = filters;
290+
// Order of filters is
291+
// - File Extension Match
292+
// - All Files
293+
// - All Languages
294+
// - No Extension
295+
options.filters = coalesce([
296+
matchingFilter,
297+
{ name: nls.localize('allFiles', "All Files"), extensions: ['*'] },
298+
...filters,
299+
{ name: nls.localize('noExt', "No Extension"), extensions: [''] }
300+
]);
297301

298302
return options;
299303
}

0 commit comments

Comments
 (0)