diff --git a/src/custom-sort/custom-sort-types.ts b/src/custom-sort/custom-sort-types.ts index b9461d2..5dea555 100644 --- a/src/custom-sort/custom-sort-types.ts +++ b/src/custom-sort/custom-sort-types.ts @@ -13,14 +13,10 @@ export enum CustomSortGroupType { export enum CustomSortOrder { alphabetical = 1, // = 1 to allow: if (customSortOrder) { ... - alphabeticalLowerFirst, - alphabeticalUpperFirst, alphabeticalWithFileExt, trueAlphabetical, trueAlphabeticalWithFileExt, alphabeticalReverse, - alphabeticalLowerFirstReverse, - alphabeticalUpperFirstReverse, alphabeticalReverseWithFileExt, trueAlphabeticalReverse, trueAlphabeticalReverseWithFileExt, diff --git a/src/custom-sort/custom-sort.ts b/src/custom-sort/custom-sort.ts index 976e834..97d81ae 100644 --- a/src/custom-sort/custom-sort.ts +++ b/src/custom-sort/custom-sort.ts @@ -49,20 +49,6 @@ export const CollatorCompare = new Intl.Collator(undefined, { numeric: true, }).compare; -export const CollatorCompareUpperFirst = new Intl.Collator(undefined, { - usage: "sort", - sensitivity: "base", - numeric: true, - caseFirst: "upper" -}).compare; - -export const CollatorCompareLowerFirst = new Intl.Collator(undefined, { - usage: "sort", - sensitivity: "base", - numeric: true, - caseFirst: "lower" -}).compare; - export const CollatorTrueAlphabeticalCompare = new Intl.Collator(undefined, { usage: "sort", sensitivity: "base", @@ -193,16 +179,12 @@ const folderGoesFirstWhenSameBasenameAsFolder = (stringCompareResult: number, a: const Sorters: { [key in CustomSortOrder]: SorterFn } = { [CustomSortOrder.alphabetical]: (a: FIFS, b: FIFS) => CollatorCompare(a.sortString, b.sortString), - [CustomSortOrder.alphabeticalLowerFirst]: (a: FIFS, b: FIFS) => CollatorCompareLowerFirst(a.sortString, b.sortString), - [CustomSortOrder.alphabeticalUpperFirst]: (a: FIFS, b: FIFS) => CollatorCompareUpperFirst(a.sortString, b.sortString), [CustomSortOrder.alphabeticalWithFilesPreferred]: (a: FIFS, b: FIFS) => fileGoesFirstWhenSameBasenameAsFolder(CollatorCompare(a.sortString, b.sortString),a,b), [CustomSortOrder.alphabeticalWithFoldersPreferred]: (a: FIFS, b: FIFS) => fileGoesFirstWhenSameBasenameAsFolder(CollatorCompare(a.sortString, b.sortString),a,b), [CustomSortOrder.alphabeticalWithFileExt]: (a: FIFS, b: FIFS) => CollatorCompare(a.sortStringWithExt, b.sortStringWithExt), [CustomSortOrder.trueAlphabetical]: (a: FIFS, b: FIFS) => CollatorTrueAlphabeticalCompare(a.sortString, b.sortString), [CustomSortOrder.trueAlphabeticalWithFileExt]: (a: FIFS, b: FIFS) => CollatorTrueAlphabeticalCompare(a.sortStringWithExt, b.sortStringWithExt), [CustomSortOrder.alphabeticalReverse]: (a: FIFS, b: FIFS) => CollatorCompare(b.sortString, a.sortString), - [CustomSortOrder.alphabeticalLowerFirstReverse]: (a: FIFS, b: FIFS) => CollatorCompareLowerFirst(b.sortString, a.sortString), - [CustomSortOrder.alphabeticalUpperFirstReverse]: (a: FIFS, b: FIFS) => CollatorCompareUpperFirst(b.sortString, a.sortString), [CustomSortOrder.alphabeticalReverseWithFileExt]: (a: FIFS, b: FIFS) => CollatorCompare(b.sortStringWithExt, a.sortStringWithExt), [CustomSortOrder.trueAlphabeticalReverse]: (a: FIFS, b: FIFS) => CollatorTrueAlphabeticalCompare(b.sortString, a.sortString), [CustomSortOrder.trueAlphabeticalReverseWithFileExt]: (a: FIFS, b: FIFS) => CollatorTrueAlphabeticalCompare(b.sortStringWithExt, a.sortStringWithExt), diff --git a/src/custom-sort/sorting-spec-processor.spec.ts b/src/custom-sort/sorting-spec-processor.spec.ts index 7ffb127..5b9201a 100644 --- a/src/custom-sort/sorting-spec-processor.spec.ts +++ b/src/custom-sort/sorting-spec-processor.spec.ts @@ -711,15 +711,8 @@ describe('SortingSpecProcessor', () => { }) }) + const txtInputExoticExperimentalSortAttr: string = ` -target-folder: upper first -< aaa-z -target-folder: upper first Rev -> aaa-z -target-folder: lower first -< a-zzz -target-folder: lower first Rev -> a-zzz target-folder: VS Code unicode lexicographic < vsc-unicode target-folder: VS Code unicode lexicographic reverse @@ -727,38 +720,6 @@ target-folder: VS Code unicode lexicographic reverse ` const expectedSortSpecForExoticExperimentalSorting: { [key: string]: CustomSortSpec } = { - "upper first": { - defaultOrder: CustomSortOrder.alphabeticalUpperFirst, - groups: [{ - type: CustomSortGroupType.Outsiders - }], - outsidersGroupIdx: 0, - targetFoldersPaths: ['upper first'] - }, - "upper first Rev": { - defaultOrder: CustomSortOrder.alphabeticalUpperFirstReverse, - groups: [{ - type: CustomSortGroupType.Outsiders - }], - outsidersGroupIdx: 0, - targetFoldersPaths: ['upper first Rev'] - }, - "lower first": { - defaultOrder: CustomSortOrder.alphabeticalLowerFirst, - groups: [{ - type: CustomSortGroupType.Outsiders - }], - outsidersGroupIdx: 0, - targetFoldersPaths: ['lower first'] - }, - "lower first Rev": { - defaultOrder: CustomSortOrder.alphabeticalLowerFirstReverse, - groups: [{ - type: CustomSortGroupType.Outsiders - }], - outsidersGroupIdx: 0, - targetFoldersPaths: ['lower first Rev'] - }, "VS Code unicode lexicographic": { defaultOrder: CustomSortOrder.vscUnicode, groups: [{ diff --git a/src/custom-sort/sorting-spec-processor.ts b/src/custom-sort/sorting-spec-processor.ts index 4fc8e79..8caed88 100644 --- a/src/custom-sort/sorting-spec-processor.ts +++ b/src/custom-sort/sorting-spec-processor.ts @@ -116,10 +116,8 @@ const MAX_SORT_LEVEL: number = 1 // remember about .toLowerCase() before comparison! const OrderLiterals: { [key: string]: CustomSortOrderAscDescPair } = { - 'a-zzz': {asc: CustomSortOrder.alphabeticalLowerFirst, desc: CustomSortOrder.alphabeticalLowerFirstReverse}, 'a-z.': {asc: CustomSortOrder.alphabeticalWithFileExt, desc: CustomSortOrder.alphabeticalReverseWithFileExt}, 'a-z': {asc: CustomSortOrder.alphabetical, desc: CustomSortOrder.alphabeticalReverse}, - 'aaa-z': {asc: CustomSortOrder.alphabeticalUpperFirst, desc: CustomSortOrder.alphabeticalUpperFirstReverse}, 'true a-z.': {asc: CustomSortOrder.trueAlphabeticalWithFileExt, desc: CustomSortOrder.trueAlphabeticalReverseWithFileExt}, 'true a-z': {asc: CustomSortOrder.trueAlphabetical, desc: CustomSortOrder.trueAlphabeticalReverse}, 'created': {asc: CustomSortOrder.byCreatedTime, desc: CustomSortOrder.byCreatedTimeReverse},