Hierarchical sort with JSON kind of loses the final closing braces
See original GitHub issueIf I get a chance I’ll try and submit a pull request for this.
Describe the bug When sorting JSON object properties with Hierarchical sort each element’s closing brace kind of comes adrift.
To Reproduce Steps to reproduce the behavior:
- Try sorting something like this ascending with the Heirachical sort…
"X-Correlation-ID": {
"$ref": "components/parameters/X-Correlation-ID.json"
},
"Authorization": {
"$ref": "components/parameters/Authorization.json"
},
- Results in…
"Authorization": {
"$ref": "components/parameters/Authorization.json"
"X-Correlation-ID": {
"$ref": "components/parameters/X-Correlation-ID.json"
},
},
Expected behavior We would expect this result…
"Authorization": {
"$ref": "components/parameters/Authorization.json"
},
"X-Correlation-ID": {
"$ref": "components/parameters/X-Correlation-ID.json"
},
Screenshots
Environment : IntelliJ IDEA 2020.3.1 (Ultimate Edition) Build #IU-203.6682.168, built on December 29, 2020 Licensed to REDACTED You have a perpetual fallback license for this version. Subscription is active until December 1, 2021. Runtime version: 11.0.9.1+11-b1145.63 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.7 GC: ParNew, ConcurrentMarkSweep Memory: 1979M Cores: 12 Registry: compiler.automake.allow.when.app.running=true Non-Bundled Plugins: com.intellij.ideolog, com.jetbrains.ChooseRuntime, com.intellij.plugins.watcher, com.jinsihou.react.snippets, com.ultrahob.zerolength.plugin, indent-rainbow.indent-rainbow, org.jetbrains.plugins.rest, mobi.hsz.idea.gitignore, AWSCloudFormation, org.zalando.intellij.swagger, String Manipulation, com.kaylerrenslow.plugin.armaplugin.id, org.jetbrains.plugins.hocon, com.jetbrains.lang.ejs, cucumber-javascript, intellij.prettierJS, com.dmarcotte.handlebars, com.intellij.react.css.modules, org.jetbrains.plugins.vue, tv.twelvetone.intellij.plugins.intellivue, org.jetbrains.kotlin, org.intellij.scala, com.jetbrains.php, com.jetbrains.twig, org.jetbrains.plugins.ruby, Pythonid, aws.toolkit, ru.adelf.idea.dotenv
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
Just right click on it
I made a failing test and I can see how this could be really tricky!
I had a look around specifically for sorting JSON and JSON Sorter exists and works well for the JSON use case, so no point reinventing the wheel 😃