R35007 / sort-json-vscode-extension

Simple JSON Object and Array sort
MIT License
14 stars 2 forks source link

Maybe it would be possible to register itself as proper formatter? #14

Closed mgzenitech closed 6 months ago

mgzenitech commented 7 months ago

Right now this extension provides custom commands, but maybe it would be possible to register as a proper JSON formatter? So that "Format Document" command would work?

{
  "json.format.enable": false,
  "[json]": {
    "editor.defaultFormatter": "Thinker.sort-json"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "Thinker.sort-json"
  }
}
R35007 commented 6 months ago

Hi @mgzenitech,

I am sorry I can't make it as a formatter. Bu this extension can format the code by using code actions.

 "editor.codeActionsOnSave": {
    "source.fixAll": "explicit"
  }

or you can set a custom key binding to format the code.

{
    "key": "cmd+shift+a",
    "command": "editor.action.codeAction",
    "args": {
        "kind": "source.fixAll.sort-json"
    }
}