Has anybody managed to successfully combine save before build and format on save in VS Code? (i.e. running a build task both formats and saves a file before building, either from the Run menu or by pressing Ctl+Shift+B keyboard shortcut). Is defining this behavior even possible and if so would anybody be so kind as to explain how to achieve this?
I do have both of these enabled. Format on save works on it's own, however running a build task only saves the file and format on save is not executed.
From googling "
github vscode issues format on save before task run", I found issue ticket Run build task formats my file #96904, which was implemented by commit3257368with commit message "Consider save when running task to be auto", which I'm pretty sure is the culprit. Switching to AUTO (along with other implications) causes unsaved files to not participate in format-on-save for the save operation done by that build task (related source code can be found here).You have the opposite user want as the person who raised issue ticket #96904. What you should do is raise a feature-request issue ticket asking for an option to make build-task-saves participate in format-on-save.