Skip to content

Commit

Permalink
Stop using Intl.Collator (#2542)
Browse files Browse the repository at this point in the history
`Intl.Collator` is not available in all environments. `localeCompare`
gives the same result

## Checklist

- [/] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet
  • Loading branch information
AndreasArvidsson authored Jul 21, 2024
1 parent d72aec3 commit aafd8cb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/cursorless-engine/src/actions/Sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ abstract class SortBase implements SimpleAction {
}

export class Sort extends SortBase {
private collator = new Intl.Collator(undefined, {
numeric: true,
caseFirst: "upper",
});

protected sortTexts(texts: string[]) {
return texts.sort(this.collator.compare);
return texts.sort((a, b) =>
a.localeCompare(b, undefined, {
numeric: true,
caseFirst: "upper",
}),
);
}
}

Expand Down

0 comments on commit aafd8cb

Please sign in to comment.