Skip to content

Commit

Permalink
Put folders before files; alphabetical sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas authored and Thomas committed Oct 9, 2024
1 parent d05e791 commit a589351
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
9 changes: 0 additions & 9 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Files2Prompt",
"icon": "./files2prompt-icon.webp",
"description": "Copy file contents for LLM prompts",
"version": "1.1.2",
"version": "1.2.0",
"publisher": "thomas-mckanna",
"keywords": [
"files",
Expand Down
7 changes: 7 additions & 0 deletions src/fileTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ export class FileTreeProvider implements vscode.TreeDataProvider<FileItem> {
withFileTypes: true,
});

// Sort directories above files and alphabetically
dirEntries.sort((a, b) => {
if (a.isDirectory() && !b.isDirectory()) return -1;
if (!a.isDirectory() && b.isDirectory()) return 1;
return a.name.localeCompare(b.name);
});

for (const entry of dirEntries) {
const fullPath = path.join(dirPath, entry.name);
const relativePath = path.relative(this.workspaceRoot, fullPath);
Expand Down

0 comments on commit a589351

Please sign in to comment.