Logo
Published on

VSCode AutoSave

Authors

Photo by Vincent Botta on Unsplash

This will be a short one, boosting your productivity a tiny bit more by removing the "unsaved changes dance" (tabbing to your browser, noticing that you didn't save, tabbing back, ...)

I wasn't aware of this feature for a very long time but VSCode has the ability to auto save your work!

There are several options VSCode has to offer, you can find them by opening the settings (CTRL+, or CMD+,) and looking for "auto save".

VSCode auto save

You can let VSCode save after every x milliseconds or so, it can also save when the editor loses focus or when the window loses focus.

Since I am working a lot with projects that support hot reloading, I tend to stay away from saving after a fixed time interval. It makes more sense to use the focus or window change events. What's the difference you might ask.

onFocusChange will also save when you switch to the Terminal or any other built-in VSCode feature (such as the git integration). Whereas onWindowChange only triggers when leaving VSCode. To me, this makes onFocusChange a better candidate but this is only a personal preference.

👉Auto save is a nifty feature to have that makes your life easier as a dev while working in VS Code. Here are 15 other must-have VS Code plugins that can significantly improve your developer experience.

That's all, folks! I hope you found this useful and it saves you some keystrokes.