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

Incorrect JSON sort order #228829

Closed
argvchs opened this issue Sep 17, 2024 · 4 comments · Fixed by microsoft/vscode-json-languageservice#255
Closed

Incorrect JSON sort order #228829

argvchs opened this issue Sep 17, 2024 · 4 comments · Fixed by microsoft/vscode-json-languageservice#255
Assignees
Labels
json JSON support issues json-sorting under-discussion Issue is under discussion for relevance, priority, approach

Comments

@argvchs
Copy link

argvchs commented Sep 17, 2024

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.93.1 38c31bc x64
  • OS Version: Windows 10.0.27695.1000

Steps to Reproduce:

  1. Create this JSON file.
{
    "a0": "a0",
    "[a0]": "[a0]",
    "A1": "A1",
    "[A1]": "[A1]",
    "B0": "B0",
    "[B0]": "[B0]",
    "b1": "b1",
    "[b1]": "[b1]"
}
  1. Sort it.

Expected result:

{
    "[a0]": "[a0]",
    "[A1]": "[A1]",
    "[B0]": "[B0]",
    "[b1]": "[b1]",
    "a0": "a0",
    "A1": "A1",
    "B0": "B0",
    "b1": "b1"
}

Actual result:

{
    "A1": "A1",
    "B0": "B0",
    "[A1]": "[A1]",
    "[B0]": "[B0]",
    "[a0]": "[a0]",
    "[b1]": "[b1]",
    "a0": "a0",
    "b1": "b1"
}
@argvchs
Copy link
Author

argvchs commented Sep 17, 2024

Reverting VS Code to 1.92.2 fee1edb could resolve this issue.

@aeschli aeschli assigned aiday-mar and unassigned aeschli Sep 17, 2024
@aiday-mar aiday-mar added json JSON support issues json-sorting labels Sep 18, 2024
@j-seixas
Copy link

I'm having this issue as well. The behaviour changed since last updated vscode. It was working as the mentioned "expected result" and now it isn't. Any option to rollback or introduce setting to change behaviours?

@j-seixas
Copy link

Problem is here microsoft/vscode-json-languageservice#238 . It was added wrongly an ascii sorting

@aiday-mar aiday-mar added the under-discussion Issue is under discussion for relevance, priority, approach label Dec 10, 2024
@aiday-mar
Copy link
Contributor

This issue will be fixed by using the localeCompare method instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
json JSON support issues json-sorting under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants