Had this problem which was caused as I had Format on Save Mode set to "modifications". When I changed it to "File", it was fixed.
- At the top right corner of vs code, go to: File > Preferences >
Settings or press Ctrl+, (ctrl and comma).
- This will open the settings. At the top search bar, type "format on save" and the the option to change "Format on Save Mode" will appear. Select "file" from the dropdown.
Format on Save Mode Picture