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

VSCode sorts text in xml tags incorrectly #84157

Closed
AndrewRayCode opened this issue Nov 7, 2019 · 2 comments
Closed

VSCode sorts text in xml tags incorrectly #84157

AndrewRayCode opened this issue Nov 7, 2019 · 2 comments
Assignees
Labels
info-needed Issue requires more information from poster upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@AndrewRayCode
Copy link

  • VSCode Version: 1.40.0
  • OS Version: Sierra

Paste this code into a new editor:

<members>Some_String</members>
<members>Some_String_Long</members>
<members>Some_String_Long_Er</members>

command-a and sort lines ascending, it incorrectly reverses the order

Now paste in this code:

Some_String
Some_String_Long
Some_String_Long_Er

command-a and sort lines ascending. the correct sort order is preserved

I don't think this is a dupe of #48123 ?

@vscodebot vscodebot bot added the new release label Nov 7, 2019
@alexdima
Copy link
Member

alexdima commented Nov 7, 2019

I agree this is super weird, but that is what v8 does:

This can be executed in nodejs/Chrome/FF as well

function sort(lang, letters) {
  letters.sort(new Intl.Collator(lang).compare);
  return letters;
}

console.log(sort('en', ["<members>Some_String</members>", "<members>Some_String_Long</members>", "<members>Some_String_Long_Er</members>"]));
// ["<members>Some_String_Long_Er</members>", "<members>Some_String_Long</members>", "<members>Some_String</members>"]

console.log(sort('en', ["Some_String", "Some_String_Long", "Some_String_Long_Er"]));
// ["Some_String", "Some_String_Long", "Some_String_Long_Er"]

What is very interesting is that I can reproduce this in Firefox as well, so I guess that is just how sorting is defined for the English language?

I also don't see what else we should do on our side. We must use the Intl.Collator in our implementation to sort lines, in order to pick up the OS locale and use the rules of the OS language.

See also #70920 (comment)

If you feel strongly about this, then please open an issue directly against v8 at https://bugs.chromium.org/p/v8/issues/list and link to it here.

@alexdima alexdima added upstream Issue identified as 'upstream' component related (exists outside of VS Code) info-needed Issue requires more information from poster labels Nov 7, 2019
@alexdima alexdima self-assigned this Nov 7, 2019
@vscodebot vscodebot bot removed the new release label Nov 11, 2019
@vscodebot vscodebot bot closed this as completed Nov 25, 2019
@vscodebot
Copy link

vscodebot bot commented Nov 25, 2019

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants