Skip to main content

Disable auto save in JetBrains IDE software (IntelliJ IDEA, PyCharm, PhpStorm)

JetBrains provides the following IDE software:
  • IntelliJ IDEA
  • PhpStorm
  • PyCharm
  • RubyMine
  • WebStorm
  • AppCode
  • CLion
Google also provides Android Studio which is powered by the IntelliJ platform.

If you come from a different IDE such as Eclipse, you will be unpleasantly surprised to find that JetBrains-branded IDEs automatically save everything the moment you look away. The proponents argue that as you work on your project, you should not have to worry about saving files. But to others, this auto-save behavior which is enabled by default is a curse that catches them by surprise, and a shocking departure from the workflow they are very much used to.

You can change the behavior by altering some settings.
After the change:
  • Modifications are no longer automatically saved when you're just editing.
  • They are saved when you press Ctrl+S.
  • They are saved when you build, compile or run.
  • Refactoring that affect files that are not open are still automatically saved without opening those files.

But first, some caveats:
  • There is no Save for individual tabs. The shortcut Ctrl+S is for "Save All" which will save all modified tabs/files. Be careful and remember this.
  • The "modified" indicator on the tab is slightly different. Instead of something obvious like a real asterisk next to the file name or a color change, the indicator is a subtle asterisk image that appears on top of the file icon (in the tab bar). You may have to look a bit longer at the tab to notice it.
  • Closing a tab with a modified file will not ask you whether to save or discard the changes. Instead the file is maintained in "Local History" in a modified state. When you open the file again, your changes (along with undo-redo history) are retrieved from the Local History. The actual file itself is not saved with your modifications.
  • There is no option to revert changes to the state of file on disk in the IDE user interface.
    • You can force a revert quickly by touching the file (or simply editing it insignificantly in an external editor and saving it) and then switching to the IDE. It will prompt how to resolve the conflict, on which you can select "Load File System Changes".
    • You can also undo your edits until the asterisk disappears, or revert to an older revision in VCS > Local History. (Note that "File > Synchronize" option acts similar to "Save All" and is not a way to revert.)
How to disable auto-save:
  1. Go to File > Settings (Ctrl+Alt+S).
  2. Go to Appearance & Behavior > System Settings.
  3. Make sure the two are unchecked:
    • Save files on frame deactivation
    • Save files automatically if application is idle for x sec.
  4. Go to Editor > General > Editor Tabs
  5. Put a checkmark on "Mark modified files with asterisk"
  6. (Optional but recommended) Under "Tab Closing Policy", select "Close non-modified files first". You may also want to increase the number of allowed tabs.
  7. Click Apply > OK.
That's it.

JetBrains IDEs are built around the idea that workflows should be centered around a VCS (version control system) where files are logical abstractions of changes, and that VCS should not be an afterthought as it is in the kind of workflows we are used to in other IDEs and programs - manually saving changes to a file in disk, then separately committing changes to VCS. Thus the IDEs come with instant auto-save and a built-in VCS called "Local History".

However, many of us are not used to this kind of behavior and would want to retain our workflows centered around manually saving edits to a file in disk. Though unfortunately JetBrains IDEs don't allow us to truly revert to such a workflow (see caveats), at least we can come close with the above setting changes.

Comments

Popular posts from this blog

Stop having to click Unblock on every downloaded file

CAUTION: The blocking of downloaded files in Windows is a security and safety feature to help prevent your computer from being infected by viruses and other malware. Only disable this feature if you know what you're doing.

I had been plagued by this annoyance since the days of Windows Vista. Any downloaded file, no matter what browser I use, gets tagged as "blocked" by Windows. You can open downloaded documents even though they are blocked, but when you run a downloaded application (such as a setup file) you're presented with a "Security Warning" before you're allowed to run it. It's worse if you extract a downloaded ZIP file with the Windows' built-in ZIP management. Every extracted file is blocked by default.

Being a geek who finds unnecessary "security" prompts annoying, the first thing I do in Windows is to disable the User Account Control (UAC). But I couldn't quite figure out how to disable blocking of downloaded files until …

Install Windows 10 Tech Preview when setup says media driver missing

Skip to the end for instructions.
I had been trying to install Windows 10 Pro Technical Preview onto a VHD, as I have Windows 7 Ultimate and can run an operating system from VHD (this feature is apparently limited to Enterprise and Ultimate editions).

While I had successfully managed to install it on a virtual machine in Oracle VirtualBox, I was dissatisfied with the sluggish performance of a VM. At the same time, I also did not want to dedicate a real hard disk partition for the sole purpose of installing Windows 10 TP.

Hence the decision to install into a VHD, which is a very neat solution that lets me keep Windows 10 TP separate from my real hard disk partitions and still enjoy the full native speeds of my real hardware. I had previously installed Windows 8 RC successfully into a VHD so I knew what I was up against.

Or so I thought. As soon as I booted up the setup disk (the ISO I had downloaded) and clicked on Install Now, I received this very unhelpful error asking for device dri…