When I close a file in PhpStorm, it saves the file automatically. How can I change it to ask me "Do you want do save the file before closing?"
PhpStorm automatically saves changes that you make in your files. Saving is triggered by various events, such as running, debugging, performing version control operations, closing a file or a project, or quitting the IDE. Saving files can be also triggered by third-party plugins.
1. In Settings -> IDE Settings -> General, uncheck "Synchronize files on frame activation" uncheck "Save files on frame deactivation"
In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Appearance & Behavior | System Settings. Under Autosave, configure the following options: Save files when switching to a different application or a built-in terminal: Save all modified files when you switch from PyCharm to a different application.
Automatic save can be disabled using the following options: File | Settings | Appearance & Behavior | System Settings > Uncheck these boxes below: Save files on frame deactivation.
Autosave settings are under File | Settings | General.
http://www.jetbrains.com/phpstorm/webhelp/saving-and-reverting-changes.html
While autosaving is handy for local, non-vital projects, this can be disastrous in a live project, where every change needs to be checked first.
Update: In recent versions, they have been moved to File | Settings | Appearance and Behavior | System Settings | Synchronization
There is no way to disable automatic save completely, but you can partially control this behavior:
Note that those are optional autosave triggers, and you cannot turn off autosave completely.
The answer below from @Owen is not correct, since there is no way to completely turn off automatic save in the IDE.
Automatic save is the core design feature, we believe that it's much more efficient and productive than manual save. There is no way to disable this behavior or enable any confirmations, quoting the FAQ (WebStorm is based on IntelliJ IDEA platform, so the same applies):
Because IntelliJ IDEA has the ability to change so many files simultaneously in large refactoring actions, and change them without ever opening them, single file saves don't make very much sense. In recognition of this, IntelliJ IDEA reserves the right to save any of your files literally whenever it wishes. It's actually quite nice to never have to worry about your file's save statuses, once you get used to it.
"What if I don't like some changes I made, and want to roll them back?", I hear you say. Well, for that IntelliJ IDEA includes this amazing feature called the Local History. Every time it saves your files, IntelliJ IDEA actually saves a diff of your file from it's previous state, and saves that as well. You can see the entire edit history of your files (going back some configurable number of days), see the changes you've made, and roll back any change. It rules triumphantly, and more than makes up for the temporary disorientation caused by lack of single-file save.
This feature has been in IntelliJ IDEA for a decade, and now even Apple has recognized that it's better than manual saving and implemented it in Mac OS Lion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With