Skip to content

Commit

Permalink
Switching from String.localeCompare() to Intl.Collator
Browse files Browse the repository at this point in the history
  • Loading branch information
jchadwick committed Jan 15, 2017
1 parent 2bb0cf9 commit afc5448
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vs/base/common/comparers.ts
Expand Up @@ -7,8 +7,10 @@
import scorer = require('vs/base/common/scorer');
import strings = require('vs/base/common/strings');

const FileNameComparer = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });

export function compareFileNames(one: string, other: string): number {
return (one || '').localeCompare((other || ''), undefined, { numeric: true, sensitivity: 'base' });
return FileNameComparer.compare(one || '', other || '');
}

export function compareAnything(one: string, other: string, lookFor: string): number {
Expand Down

0 comments on commit afc5448

Please sign in to comment.