Skip to content

Commit a589351

Browse files
ThomasThomas
authored andcommitted
Put folders before files; alphabetical sort
1 parent d05e791 commit a589351

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

CHANGELOG.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Files2Prompt",
44
"icon": "./files2prompt-icon.webp",
55
"description": "Copy file contents for LLM prompts",
6-
"version": "1.1.2",
6+
"version": "1.2.0",
77
"publisher": "thomas-mckanna",
88
"keywords": [
99
"files",

src/fileTreeProvider.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ export class FileTreeProvider implements vscode.TreeDataProvider<FileItem> {
4949
withFileTypes: true,
5050
});
5151

52+
// Sort directories above files and alphabetically
53+
dirEntries.sort((a, b) => {
54+
if (a.isDirectory() && !b.isDirectory()) return -1;
55+
if (!a.isDirectory() && b.isDirectory()) return 1;
56+
return a.name.localeCompare(b.name);
57+
});
58+
5259
for (const entry of dirEntries) {
5360
const fullPath = path.join(dirPath, entry.name);
5461
const relativePath = path.relative(this.workspaceRoot, fullPath);

0 commit comments

Comments
 (0)