Skip to content

Commit

Permalink
Sort the entrypoint file candidate list (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitphx committed Apr 12, 2023
1 parent 612fe57 commit 996f8a3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/vscode-stlite/src/web/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,20 @@ export function activate(context: vscode.ExtensionContext) {
)
: [];

const sortedEntrypointCandidates = entrypointCandidates.sort(
(a, b) => {
const aSegs = a.relPath.split(path.sep);
const bSegs = b.relPath.split(path.sep);
if (aSegs.length !== bSegs.length) {
return aSegs.length - bSegs.length;
}
const aBasename = aSegs[aSegs.length - 1];
const bBasename = bSegs[bSegs.length - 1];
return aBasename.localeCompare(bBasename);
}
);
const entrypoint = await vscode.window
.showQuickPick(entrypointCandidates, {
.showQuickPick(sortedEntrypointCandidates, {
canPickMany: false,
placeHolder: "Select the entrypoint file",
})
Expand Down

0 comments on commit 996f8a3

Please sign in to comment.