Open nerdo opened 7 years ago
Any change anyone has a hint on this?
Nothing yet...?
I installed the macros extension, then on the user settings JSON (settings.json), add the following:
"macros": {
"fixOnSave": [
"phpformatter.fix",
"workbench.action.files.save"
]
}
Then edit your keybindings. Go to keybindings.json (Preferences > Keyboard Shortcuts) and override the default action of CTRL + S
:
{ "key": "ctrl+s", "command": "macros.fixOnSave" }
Note that this only works when you save using CTRL + S
, not through other means (or it may, never actually tested, I just assumed that since it runs through the keybinding that it doesn't work anywhere else).
UPDATE: This doesn't work properly. The delay for formatting doesn't overwrite the save state, causing Visual Studio Code to act as if the file isn't saved.
The docs say that this extension supports fixing a file on save, but doesn't explain how to do that.
I also noticed a commit message saying the onSave command was removed. Is the feature no longer available? Kind of a bummer if that's the case...