mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 18:48:33 -05:00
Merge from vscode 79a1f5a5ca0c6c53db617aa1fa5a2396d2caebe2
This commit is contained in:
@@ -279,21 +279,25 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
|
||||
return filter;
|
||||
}));
|
||||
|
||||
// Filters are a bit weird on Windows, based on having a match or not:
|
||||
// Match: we put the matching filter first so that it shows up selected and the all files last
|
||||
// No match: we put the all files filter first
|
||||
const allFilesFilter = { name: nls.localize('allFiles', "All Files"), extensions: ['*'] };
|
||||
if (matchingFilter) {
|
||||
filters.unshift(matchingFilter);
|
||||
filters.unshift(allFilesFilter);
|
||||
} else {
|
||||
filters.unshift(allFilesFilter);
|
||||
// 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) {
|
||||
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
|
||||
}
|
||||
|
||||
// Allow to save file without extension
|
||||
filters.push({ name: nls.localize('noExt', "No Extension"), extensions: [''] });
|
||||
|
||||
options.filters = filters;
|
||||
// Order of filters is
|
||||
// - File Extension Match
|
||||
// - All Files
|
||||
// - All Languages
|
||||
// - No Extension
|
||||
options.filters = coalesce([
|
||||
matchingFilter,
|
||||
{ name: nls.localize('allFiles', "All Files"), extensions: ['*'] },
|
||||
...filters,
|
||||
{ name: nls.localize('noExt', "No Extension"), extensions: [''] }
|
||||
]);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ export class SimpleFileDialog {
|
||||
this.filePickBox.validationMessage = undefined;
|
||||
const filePickBoxUri = this.filePickBoxValue();
|
||||
let updated: UpdateResult = UpdateResult.NotUpdated;
|
||||
if (!resources.isEqual(this.currentFolder, filePickBoxUri, true)) {
|
||||
if (!resources.extUriIgnorePathCase.isEqual(this.currentFolder, filePickBoxUri)) {
|
||||
updated = await this.tryUpdateItems(value, filePickBoxUri);
|
||||
}
|
||||
if (updated === UpdateResult.NotUpdated) {
|
||||
@@ -448,7 +448,7 @@ export class SimpleFileDialog {
|
||||
|
||||
private filePickBoxValue(): URI {
|
||||
// The file pick box can't render everything, so we use the current folder to create the uri so that it is an existing path.
|
||||
const directUri = this.remoteUriFrom(this.filePickBox.value);
|
||||
const directUri = this.remoteUriFrom(this.filePickBox.value.trimRight());
|
||||
const currentPath = this.pathFromUri(this.currentFolder);
|
||||
if (equalsIgnoreCase(this.filePickBox.value, currentPath)) {
|
||||
return this.currentFolder;
|
||||
@@ -541,7 +541,7 @@ export class SimpleFileDialog {
|
||||
value = this.pathFromUri(valueUri);
|
||||
await this.updateItems(valueUri, true);
|
||||
return UpdateResult.Updated;
|
||||
} else if (!resources.isEqual(this.currentFolder, valueUri, true) && (this.endsWithSlash(value) || (!resources.isEqual(this.currentFolder, resources.dirname(valueUri), true) && resources.isEqualOrParent(this.currentFolder, resources.dirname(valueUri), true)))) {
|
||||
} else if (!resources.extUriIgnorePathCase.isEqual(this.currentFolder, valueUri) && (this.endsWithSlash(value) || (!resources.extUriIgnorePathCase.isEqual(this.currentFolder, resources.dirname(valueUri)) && resources.extUriIgnorePathCase.isEqualOrParent(this.currentFolder, resources.dirname(valueUri))))) {
|
||||
let stat: IFileStat | undefined;
|
||||
try {
|
||||
stat = await this.fileService.resolve(valueUri);
|
||||
@@ -560,7 +560,7 @@ export class SimpleFileDialog {
|
||||
return UpdateResult.InvalidPath;
|
||||
} else {
|
||||
const inputUriDirname = resources.dirname(valueUri);
|
||||
if (!resources.isEqual(resources.removeTrailingPathSeparator(this.currentFolder), inputUriDirname, true)) {
|
||||
if (!resources.extUriIgnorePathCase.isEqual(resources.removeTrailingPathSeparator(this.currentFolder), inputUriDirname)) {
|
||||
let statWithoutTrailing: IFileStat | undefined;
|
||||
try {
|
||||
statWithoutTrailing = await this.fileService.resolve(inputUriDirname);
|
||||
@@ -865,7 +865,7 @@ export class SimpleFileDialog {
|
||||
private createBackItem(currFolder: URI): FileQuickPickItem | null {
|
||||
const fileRepresentationCurr = this.currentFolder.with({ scheme: Schemas.file });
|
||||
const fileRepresentationParent = resources.dirname(fileRepresentationCurr);
|
||||
if (!resources.isEqual(fileRepresentationCurr, fileRepresentationParent, true)) {
|
||||
if (!resources.extUriIgnorePathCase.isEqual(fileRepresentationCurr, fileRepresentationParent)) {
|
||||
const parentFolder = resources.dirname(currFolder);
|
||||
return { label: '..', uri: resources.addTrailingPathSeparator(parentFolder, this.separator), isFolder: true };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user