microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.62k stars 29.42k forks source link

Incorrect JSON sort order #228829

Open argvchs opened 2 months ago

argvchs commented 2 months ago

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

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 commented 2 months ago

Reverting VS Code to 1.92.2 fee1edb8d6d72a0ddff41e5f71a671c23ed924b9 could resolve this issue.

j-seixas commented 1 month ago

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 commented 1 month ago

Problem is here https://github.com/microsoft/vscode-json-languageservice/pull/238 . It was added wrongly an ascii sorting