summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useCompletion.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/hooks/useCompletion.ts')
-rw-r--r--packages/cli/src/ui/hooks/useCompletion.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/cli/src/ui/hooks/useCompletion.ts b/packages/cli/src/ui/hooks/useCompletion.ts
index 1f6e570d..8b3f6991 100644
--- a/packages/cli/src/ui/hooks/useCompletion.ts
+++ b/packages/cli/src/ui/hooks/useCompletion.ts
@@ -471,7 +471,19 @@ export function useCompletion(
if (aIsDir && !bIsDir) return -1;
if (!aIsDir && bIsDir) return 1;
- return a.label.localeCompare(b.label);
+ // exclude extension when comparing
+ const filenameA = a.label.substring(
+ 0,
+ a.label.length - path.extname(a.label).length,
+ );
+ const filenameB = b.label.substring(
+ 0,
+ b.label.length - path.extname(b.label).length,
+ );
+
+ return (
+ filenameA.localeCompare(filenameB) || a.label.localeCompare(b.label)
+ );
});
if (isMounted) {