Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing sorting of directory and filenames with numbers #18539

Merged
merged 2 commits into from Jan 16, 2017

Conversation

Projects
None yet
4 participants
@jchadwick
Copy link
Contributor

commented Jan 14, 2017

These changes replace the existing regex-based sorting of filenames and directory names with a call to the String.prototype.localeCompare() function which supports this natively via the numeric option.

Also added some unit test cases for filenames with numbers.

CC: @bpasero

Fixes #17495

@bpasero

This comment has been minimized.

Copy link
Member

commented Jan 14, 2017

@jchadwick incredible, I was not aware of these options. Thanks for enlighten me 👍

@bpasero bpasero self-assigned this Jan 14, 2017

@paror

This comment has been minimized.

Copy link

commented Jan 14, 2017

I read this on MDN about String.prototype.localeCompare(): When comparing large numbers of strings, such as in sorting large arrays, it is better to create an Intl.Collator object and use the function provided by its compare property.

@jchadwick

This comment has been minimized.

Copy link
Contributor Author

commented Jan 14, 2017

yeah I saw that too but it wasn't obvious how to do that here. I can take a stab, though.

@jchadwick

This comment has been minimized.

Copy link
Contributor Author

commented Jan 14, 2017

Wow. Intl.Collator is significantly (97%) faster! (And I've switched to it)

@jchadwick jchadwick force-pushed the jchadwick:jchadwick/explorer-sorting-issue branch from c02e2ad to afc5448 Jan 15, 2017

@paror

This comment has been minimized.

Copy link

commented Jan 15, 2017

Nice!

@bpasero bpasero added this to the February 2017 milestone Jan 16, 2017

@bpasero

This comment has been minimized.

Copy link
Member

commented Jan 16, 2017

LGTM

@bpasero bpasero merged commit 7a949d8 into microsoft:master Jan 16, 2017

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@jchadwick

This comment has been minimized.

Copy link
Contributor Author

commented Feb 3, 2017

Hey @bpasero, just an FYI, this wasn't attributed to me in the 1.9 release notes.

@bpasero

This comment has been minimized.

Copy link
Member

commented Feb 3, 2017

@jchadwick sorry for that, I wrongly set this PR for February and so it was not picked up by our automated tool that generates release notes for PRs. I will add this, but it might take a day or two until our website gets redeployed.

@bpasero

This comment has been minimized.

Copy link
Member

commented Feb 3, 2017

Added via microsoft/vscode-docs@229ceeb so it should be in the next website update.

@jchadwick

This comment has been minimized.

Copy link
Contributor Author

commented Feb 3, 2017

@bpasero No worries. Thanks!

@jchadwick jchadwick deleted the jchadwick:jchadwick/explorer-sorting-issue branch Feb 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.