richie5um / vscode-sort-json

VSCode Extension to Sort JSON objects
https://marketplace.visualstudio.com/items?itemName=richie5um2.vscode-sort-json
MIT License
110 stars 19 forks source link

Default to Sort Entire Document if No Selection #48

Closed Antyos closed 2 years ago

Antyos commented 3 years ago

Although not a huge deal, I think it would be a nice addition to default to sorting an entire json document if there is nothing selected. For new users who don't necessarily read the documentation (like myself...) noting the extension formats based on selection, it would be especially helpful.

This could either be implemented by:

  1. Adding commands to differentiate sorting the selection or sorting the document, such as Sort JSON Document and Sort JSON Selection
  2. Default Sort JSON to sort the document if there is no selection, otherwise sort the selection
  3. Some combination of the previous two
Shuunen commented 2 years ago

@Antyos @NorthboundTrain @diartyz I mangaged to have this feature with a new vscode keybind :

  {
    "command": "sortJSON.sortJSON",
    "key": "ctrl+s",
    "when": "editorTextFocus && !editorReadonly && resourceExtname == .json"
  }

Hope it helps 👍

richie5um commented 2 years ago

Nice :)