It seems there are some use cases that make it useful to select and sort a subset of a JSON object, instead of the needing a whole object. I myself have wished for a feature like this and it seems some people have also requested it (#57 and maybe some others).
As a proof-of-concept, I thought maybe we could just try surrounding the selection in {} and sort that, and if it works then strip off the {} and return the result!
The result is this PR, which I'll leave as a draft just to see if there's interest in taking a change like this. I haven't tested all kinds of corner cases yet, so it's possible this breaks something, but I think the basic concept is there! I was able to format the example in the above issue as well as some entries in my VSCode settings.json (one of the main use cases I had for this feature).
It seems there are some use cases that make it useful to select and sort a subset of a JSON object, instead of the needing a whole object. I myself have wished for a feature like this and it seems some people have also requested it (#57 and maybe some others).
As a proof-of-concept, I thought maybe we could just try surrounding the selection in
{}
and sort that, and if it works then strip off the{}
and return the result!The result is this PR, which I'll leave as a draft just to see if there's interest in taking a change like this. I haven't tested all kinds of corner cases yet, so it's possible this breaks something, but I think the basic concept is there! I was able to format the example in the above issue as well as some entries in my VSCode
settings.json
(one of the main use cases I had for this feature).