Beyond Auto-save
I was recently working on a project. For some reason when I checked the feature on the browser, the change didn’t appear. I rechecked the codes a few times. Everything looks fine. I even added a tiny modification to see if the changes were being applied.
Nothing. (You might already guess it)
Perplexed, I paused working to understand what was happening.
Turns out the file changes weren’t been saved despite running the build. I immediately clicked on save all and launched again. Lo and behold, the change was now appearing.
> The main reason is that I switched from Visual Studio Code / RubyMine to Visual Studio.
Now I can’t keep track of the number of times this has happened to me throughout my career.
Eventually, when I started using Sublime Text and Visual Studio, I used the default save on window or focus lost settings. This also prevented me from tapping the Ctrl + S keys a dozen times, which can be a bad habit.
Today, we’re going to go a bit further, down to an option that can enhance your productivity even more; help you see errors or save your changes as expected.
Let’s see how to do this using Visual Studio Code.
Let’s go to Settings and enable the auto-save feature — if you don’t already have it. I like using Focus Change rather than On Delay or Windows Change but feel free to experiment and choose yours.
Note the option → Files: Auto Save When No Errors
You can also change it in the settings.json file.
> “files.autoSaveWhenNoErrors”: true
Therefore, now when you’re going to use LSPs, linters and/or build settings, you can know right off the bat if the files are being saved or if there’s an issue, without necessarily having to glance at the output panel.
Hope this helps you be more productive.