Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ - not asking if I want to save a file

I'm new to the IntelliJ IDE. In the past I was working with Visual Studio or Eclipse. In those IDEs there was an asterisk * above the name of the file which has been modified.

But in IntelliJ with the default configuration I can't see if the file is modified. What's more the file is saved automatically when I change focus to another window.

I've found some options under Settings -> IDE Settings -> General -> Synchronization:

  • Synchronize files on frame activation
  • Save files on frame deactivation
  • Save files automatically if application is idle for...

After unchecking all that options the file is not saved automatically every time I change focus to another window, which is good. But still I can't:

  • see if the file is modified (no asterisk)
  • decide if the file should be saved when I'm closing it (IDE doesn't ask for that)

And when I'm closing IntelliJ file which has been modified is saved without even noticing.

Do you know what can I do to change how IntelliJ behaves?

like image 604
Mateusz Avatar asked Jul 26 '13 09:07

Mateusz


People also ask

Does IntelliJ IDEA automatically save?

IntelliJ IDEA automatically saves changes that you make in your files. Saving is triggered by various events, such as compiling, running, debugging, performing version control operations, closing a file or a project, or quitting the IDE.

How do I save a file in IntelliJ?

Press Ctrl+Shift+S or select File | Save All from the main menu.


3 Answers

After unchecking mentioned options go to:

Settings/Editor(IDE Settings)/Editor Tabs: Check "Mark modified tabs with asterisk"

On 2019.3 Ultimate it's under:

Settings/Editor/General/Editor Tabs: Mark modified (*)

like image 131
JavAlex Avatar answered Oct 24 '22 00:10

JavAlex


The exact Save feature like eclipse is not available in IntelliJ.

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 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.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206336279/comments/207351939

like image 38
Sathesh Avatar answered Oct 24 '22 01:10

Sathesh


To show an asterisk when a file is modified: open Settings (CTRL+ALT+S), switch to Editor > General > Editor Tabs and select the Mark modified tab with asterisk checkbox.

To remove autosave, uncheck: Appearance & Behavior > System Settings > Save files on frame deactivation

like image 37
Harkály Gergő Avatar answered Oct 23 '22 23:10

Harkály Gergő