Skip to content

Commit c1ae60a

Browse files
authored
Merge pull request #61 from geriyoco/main
🚀 bump: v0.2.5
2 parents 5c24930 + d0c7961 commit c1ae60a

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [0.2.5] - 2022-04-28
4+
### Added
5+
- Sort filenames by alphanumeric order by default
6+
- Added additional configuration for sorting in settings
7+
38
## [0.2.3] - 2022-04-28
49
### Added
510
- Display filename as tab title in the viewer

package.json

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-image-gallery",
33
"displayName": "Image Gallery",
44
"description": "An extension that enhances image browsing experience.",
5-
"version": "0.2.4",
5+
"version": "0.2.5",
66
"publisher": "GeriYoco",
77
"repository": {
88
"type": "git",
@@ -24,6 +24,41 @@
2424
"main": "./dist/extension.js",
2525
"browser": "./dist/extension.js",
2626
"contributes": {
27+
"configuration": {
28+
"title": "Image Gallery",
29+
"properties": {
30+
"sorting.byPathOptions.localeMatcher": {
31+
"type": "string",
32+
"default": "best fit",
33+
"markdownDescription": "The locale matching algorithm to use. Possible values are \"`lookup`\" and \"`best fit`\"."
34+
},
35+
"sorting.byPathOptions.sensitivity": {
36+
"type": "string",
37+
"default": "variant",
38+
"markdownDescription": "Which differences in the strings should be taken into account. Possible values are:\n- \"`base`\": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A.\n- \"`accent`\": Only strings that differ in base letters or accents compare as unequal. Examples: a ≠ b, a ≠ á, a = A.\n- \"`case`\": Only strings that differ in base letters or case compare as unequal. Examples: a ≠ b, a = á, a ≠ A.\n- \"`variant`\": All strings compare as unequal."
39+
},
40+
"sorting.byPathOptions.ignorePunctuation": {
41+
"type": "boolean",
42+
"default": false,
43+
"markdownDescription": "Whether punctuation should be ignored."
44+
},
45+
"sorting.byPathOptions.numeric": {
46+
"type": "boolean",
47+
"default": true,
48+
"markdownDescription": "Whether numeric collation should be used, such that \"`img1.jpg`\" > \"`img2.jpg`\" > \"`img10.jpg`\", instead of \"`img1.jpg`\" > \"`img10.jpg`\" > \"`img2.jpg`\"."
49+
},
50+
"sorting.byPathOptions.caseFirst": {
51+
"type": "string",
52+
"default": "false",
53+
"markdownDescription": "Whether upper case or lower case should sort first. Possible values are \"`upper`\", \"`lower`\" or \"`false`\" (use the locale's default)."
54+
},
55+
"sorting.byPathOptions.collation": {
56+
"type": "string",
57+
"default": null,
58+
"markdownDescription": "Variant collations for certain locales. Possible values include:\n- \"`compat`\" - Arabic\n- \"`dict`\" - Sinhala\n- \"`emoji`\" - root\n- \"`eor`\" - root\n- \"`phonebk`\" - German\n- \"`phonetic`\" - Lingala\n- \"`pinyin`\" - Chinese\n- \"`reformed`\" - Swedish\n- \"`stroke`\" - Chinese\n- \"`trad`\"\n- \"`zhuyin`\" - Chinese"
59+
}
60+
}
61+
},
2762
"customEditors": [
2863
{
2964
"viewType": "gryc.editor",
@@ -86,4 +121,4 @@
86121
"dependencies": {
87122
"panzoom": "^9.4.2"
88123
}
89-
}
124+
}

src/main_panel.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ export async function createPanel(context: vscode.ExtensionContext, galleryFolde
1313
);
1414

1515
const imgPaths = await getImagePaths(galleryFolder);
16+
const config = vscode.workspace.getConfiguration('sorting.byPathOptions');
17+
const keys = [
18+
'localeMatcher',
19+
'sensitivity',
20+
'ignorePunctuation',
21+
'numeric',
22+
'caseFirst',
23+
'collation',
24+
];
25+
imgPaths.sort((path1, path2) => {
26+
return path1.path.localeCompare(
27+
path2.path,
28+
undefined,
29+
Object.fromEntries(
30+
keys.map(key => [key, config.get(key)])
31+
)
32+
);
33+
});
1634
panel.webview.html = getWebviewContent(context, panel.webview, imgPaths);
1735

1836
return panel;

0 commit comments

Comments
 (0)