Skip to content

Commit a98e31f

Browse files
authored
Merge pull request #2483 from github/koesie10/fix-locale-compare
Fix remaining `localeCompare` without locale set
2 parents a7a24fc + a678f8b commit a98e31f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

extensions/ql-vscode/src/data-extensions-editor/auto-model.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ export function compareInputOutput(a: string, b: string): number {
195195

196196
// If either one is unknown, it is sorted last
197197
if (aIndex === -1 && bIndex === -1) {
198-
return a.localeCompare(b);
198+
// Use en-US because these are well-known strings that are not localized
199+
return a.localeCompare(b, "en-US");
199200
}
200201
if (aIndex === -1) {
201202
return 1;

extensions/ql-vscode/src/pure/variant-analysis-filter-sort.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ export function compareRepository(
9494
}
9595
}
9696

97-
// Fall back on name compare
98-
return left.fullName.localeCompare(right.fullName, undefined, {
97+
// Fall back on name compare. Use en-US because the repository name does not contain
98+
// special characters due to restrictions in GitHub owner/repository names.
99+
return left.fullName.localeCompare(right.fullName, "en-US", {
99100
sensitivity: "base",
100101
});
101102
};

0 commit comments

Comments
 (0)