Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to format on "auto save" using VS Code? Currently, it only formats on manual save (ex. control+s)

I have VS Code configured for formatting on saving and also configured for auto-saving after delay using the following settings:

{
   ...
   "editor.formatOnSave": true,
   "files.autoSave": "afterDelay",
   "files.autoSaveDelay": 1000,
   ...
}

But, it does not format when auto-saving, only if I explicitly save, such as using CTRL+s.

How can I get it to format automatically?

like image 849
Jason David Espinoza Siles Avatar asked Jan 29 '26 21:01

Jason David Espinoza Siles


1 Answers

I don't believe this is currently possible, see this thread for further discussion.

As pointed out in the comments, this is now possible with the use of extensions. There are two extensions suggested in the thread I originally linked:

  1. Run on Save
  2. Format on auto save

Both require adding a bit of configuration to your settings.json, check out the thread for info on how to do that.

like image 103
Jeremy Dahms Avatar answered Jan 31 '26 16:01

Jeremy Dahms



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!