microsoft / vscode

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

Incorrect JSON sort order #228829

Open argvchs opened 1 month ago

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

Reverting VS Code to 1.92.2 fee1edb8d6d72a0ddff41e5f71a671c23ed924b9 could resolve this issue.

j-seixas commented 4 weeks 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 4 weeks ago

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