Removed support for the experimental sorting methods: `aaa-z` and `a-zzz`. They weren't working correctly.
This commit is contained in:
parent
53b5895e81
commit
424e56c962
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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: [{
|
||||
|
|
|
@ -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},
|
||||
|
|
Loading…
Reference in New Issue