Hello,
I’m trying to adjust my ctrl+s shortcut in json files to call both “lsp_format_document” and “save” in that order. Here is my current try at a corresponding keybind:
{ "keys": [ "ctrl+s" ], "context": [ { "key": "selector", "operand": "source.json", "operator": "equal" } ], "command": "multicommand", "args": { "commands": [ { "command": "lsp_format_document" }, { "command": "save", "args": { "async": true } } ] } }
After saving my sublime-keymap and testing on json files I experience the following behaviour:
- Pressing ctrl+s formats the json (adjusts indentation and such) without saving.
- Pressing ctrl+s again on the formatted json file then saves the file.
My goal, and the expected behaviour, is to do both of those things (formatting + saving) with a single keypress.
To replicate you need the packages: multicommand, lsp, lsp-json
Thanks in advance!