Fix microsoft/vscode#209655: fix case-sensitive JSON sorting error #238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the case-sensitive JSON sorting error described in microsoft/vscode#209655. The issue caused incorrect sorting of JSON properties with mixed-case names, like "test" and "Test".
Details
The problem was due to the sorting mechanism not handling case sensitivity properly, causing it to sort properties at random since it didn't know how to handle the mixed-case names. A new function was introduced to sort properties in a case-sensitive manner, ensuring accurate ordering of property names.
Testing
Two unit tests were added:
These tests cover the description of the issue.
This fix ensures that JSON properties are sorted correctly, addressing the reported issue.