Make @ command sort file without extension name (#4158)

This commit is contained in:
Sandy Tao
2025-07-14 14:10:26 -07:00
committed by GitHub
parent ff3722a3a7
commit 7ffe8038ef
2 changed files with 957 additions and 1 deletions

View File

@@ -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) {