Currently Being Moderated

Why there is no Save and Save As... options, how can I save single file?

VERSION 3

Created on: Jan 26, 2006 2:54 AM by Serge Baranov - Last Modified:  Sep 11, 2011 3:26 PM by Serge Baranov

Dave Griffith explains:

 

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.

 

Instead of Save As... you should use Refactor | Copy.

Average User Rating
(18 ratings)




Martin Hansson Martin Hansson  says:

I think this makes a lot of people really frustrated. I am one of them, and I know for a fact that this "feature" is what keeps some people from using IntelliJ.

Often, I make small changes to single files just to see how it works out. Instead of closing the file, answering "no" on whether I would like to save I have to go back to the local version control system to really make sure I didn't make anything silly. Or in some cases I need to revert from my own subversion archive.

This automatic save doesn't always automatically save either. I actually went through two builds wondering why my changes didn't work only to find out that IntelliJ had not saved. So in the end I had to press Ctrl + S to force the IDE to save my file, and then the changes "stuck" in the build, which made it counteract its very meaning; to save keystrokes and time.

 

I want to decide what to save, and when. You guys should at least add an option to turn this "feature" off.

Quadro Val Quadro Val  says in response to Martin Hansson:

I completely agree with Martin Hansson.

 

 

And I think it's not hard to implement feature like save current file and to give choise for users to use it or not. Maybe even to stay "Save all" by default. But I believe that having a real choice will make your product better.

Juan Uys Juan Uys  says:

I agree with you guys.

 

I'd like to see a * next to the modified file's name. I'd like to save what I want. By default.

 

Why go against the standard way almost every other editor has done it for years?

Aardwolf Aardwolf  says:

To me this feature works reasonably well, except there should be a "Save Copy As" option to save a copy of a single file in some other location you can choose.

Alan Plum Alan Plum  says:

I'd say this certainly violates the principle of least surprise.

 

I was confused when I found out that closing a tab would not discard the changes, which was a feature I have relied on a lot when using other editors or IDEs. I can see why project-wide refactorings and such would affect files you haven't opened, but most projects are too large to keep changesets like that in your head and other editors/IDEs solve it by either opening all auto-modified files in new tabs or just saving the changes automatically (which would work well with IDEA's integrated version control).

 

Likewise, Refactor->Copy may seem intuitive if you've been using IDEA for months, but most people coming from other applications will expect Save As and will forget about Refactor->Copy unless they use IDEA frequently enough to keep it in mind.

 

The inability to save individual files is particularly annoying: many times I will tweak multiple files but want to test the changes in one of them without saving all the other changes. This can be especially true if I'm working on multiple problems in the same timespan but want to commit them to my "real" version control system sequentially rather than just dumping my buffers. The lack of a proper "Save" option means I have to cherry pick the files I want to commit within the VCS rather than being able to save the files one by one. Even worse: I can't commit changes in a file if I've edited it after the last save and want to commit unsaved changes in another file at the same time (without relying on staging magic, that is).

 

It's clever, but most clever solutions aren't necessarily good. It's better to stick with what 90% of the other applications people use on a daily basis (alongside IDEA) do and then improve on that. Stuff like this (or Ctrl+W _not_ being the shortcut to close the active tab) will trip anyone up who is not familiar with IDEA or doesn't use it exclusively.

Michael Parmeley Michael Parmeley  says:

I for one love this feature. I never have to worry about accidentally losing my changes. Or forgetting to save and wondering why my changes aren't taking affect. The auto-save feature is simply another reason IntelliJ is my favorite IDE.

 

If I need to revert changes I will use version control (local history on occasion but usually a subversion revert) which is what it is for.

Steve Krichten Steve Krichten  says in response to Martin Hansson:

I agree with Martin and Alan

The original post says...

"Because 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."  Guess what... many other IDE's have refactoring and similar features, but every one I have ever used still maintains the option to save manually.  This sounds more like an excuse than a good reason.

 

If you want to have an autosave feature, great.  But let the user decide if they want to enable it or not.  Let us have the same features as every other IDE... auto save should be optional, not required.

Christos Pontikis Christos Pontikis  says in response to Steve Krichten:

I do agree with Martin, Steve.

 

PhpStorm is an excellent IDE, but Single Save is necessary...!

Dennis  Haupt Dennis Haupt  says in response to Martin Hansson:

one thing i hate about eclipse is that i have to save/sync my files manually as a "commit". idea is much better as i don't have to worry about that at all. i simply consider all files to be auto-saved and assume there is no transient state, and that's it.

Mark Vedder Mark Vedder  says:

When I first started using IDEA (9 years ago), I really disliked not having the ability to only save my work when I wanted to. It may have even boarded on hating it I fought it for a while (see settings changes below). But I got use to it; more quickly than I would have thought.(Especially once I learned about the poswer of Local History.) And now, auto-save is one of my favorite features. I've seen people using other IDEs deploy code out to a server wondering why it does not work. They finally discover they forgot to save before running a build.

 

If you really really hate it, you can go into Settings (Ctrl+Alt+S) > General and turn off "Save files on frame deactivation" and "Save files automatically if application is idle for x seconds". (You will likely also want to turn on Settings > IDE Settings > Editor >Editor Tabs > "Mark modified tabs with astrick".) Idea will then only auto save on a build/make (or any files that change via a refactoring that are not open in the editor). You can save all files manually via Ctrl+S You will not be able to save an individual file, but you at least will have a bit more control. I did this at first when using IDEA. I soon turned around 180 degrees. I know have the "Save files automatically if application is idle for x seconds" set to a very low value (10 seconds).

Mark Vedder Mark Vedder  says in response to Juan Uys:

I'd like to see a * next to the modified file's name.

Settings (Ctrl+alt+S) > IDE Settings > Editor >Editor Tabs > "Mark modified tabs with astrick"

Eduard Morozov Eduard Morozov  says in response to Martin Hansson:

100% agree. Just started using Idea and this feature is unacceptable for me

Dennis  Haupt Dennis Haupt  says in response to Eduard Morozov:

it's the other way round for me. why should i not want my files to be saved automatically? for what reason would i want to change files and then not save them? if i made a mistake, there's always "undo".

having no autosave is one of the reasons i don't use eclipse.

Mark Vedder Mark Vedder  says in response to Eduard Morozov:

@Eduard. Give it a try for a short while. It's just a different working paradigm. As I mentioned above, I use to dislike it. Now I'm a proponent of it. How often is it that you truly need to save a single file? (Since you can turn off auto save, that would be the only option you must be saying is unacceptable.) I'm curious what your use case is for only saving one file that you've changed. For the rare case of when you do need to do such, a simple shelving of any other changed files is an option. I would encourage you not to give up on trying a phenomenal IDE because of this one thing.

Christos Pontikis Christos Pontikis  says in response to Mark Vedder:

You can find arguments for each view. But I do not understand why when I am working in ONE file and I have opened  five more files, making Save at THIS file, all other files have to be saved...

 

I am wondering why all other major IDEs supports Single save and Save All.

 

Please note that I am a PhpStorm fanatic, but the lack of "Single save" is just annoying ....

Dennis  Haupt Dennis Haupt  says in response to Christos Pontikis:

what is your use case for saving a single file?

Christos Pontikis Christos Pontikis  says in response to Dennis Haupt:

no need to analyze it in depth, it can happens in every day work  e.g

  1. say A my working file
  2. I open file B, I change a line of code, then I copy the code segment from B
  3. I paste the code to A and I press save

why has B file to be saved?

Michael Parmeley Michael Parmeley  says in response to Christos Pontikis:

Does B being saved in that scenario adversely affect anything?


Christos Pontikis Christos Pontikis  says in response to Michael Parmeley:

Actually, I have to revert B using git (or whatever). It could be better if save action on file A could not affect B or any other file (according to my opinion, of course)

 

Anyway, everyone can understand that this behaviour is a design specification of PhpStorm. The question is "is it user friendly?". Best regards!

Alan Plum Alan Plum  says:

After having used Jetbrain IDEs for over a year, I have to admit I was wrong. The built-in version control complements the save-all function nicely and I only run into problems when messing with multiple files at the same time on an auto-reloading dev server. It doesn't get in the way unless you do something silly, really.

Dennis  Haupt Dennis Haupt  says in response to Christos Pontikis:

why did you change file B if you don't want it to be changed?

Steve Krichten Steve Krichten  says in response to Dennis Haupt:

For one, a change can happen by accident.  With a little imagination, I'm sure you could come up with many use cases.  Why does every other application on the planet have a single file save feature if there are no use cases for it? The fact is, many users want the feature, so why not provide it?  It doesn't really matter to me any more though.  Netbeans is working just fine, and it's free.

Dennis  Haupt Dennis Haupt  says in response to Steve Krichten:

if there are use cases, share a few of them. "changes can happen by accident" is not a use case. the only one that was mentioned was to use random files as scrathpads which is something i never did in 10 years of programming.

Dan Dascalescu Dan Dascalescu  says in response to Dennis Haupt:

There are many use cases when auto-saving can lead to unexpected and undesired results. With WebStorm:

  • using browser auto-refresh plugins or similar client-side technologies. Partial saves in the middle of typing a statement can break layout or the entire application, and the auto-refresh plugin may stop working
  • using frameworks that perform hot code pushes when files are updated, such as meteor. I've detailed how autosave breaks server code.

 

Regardless of my opinion, there's a sufficiently large user-based finding autosave harmful or annoying, to consider making it clearly optional.

James Hammond James Hammond  says in response to Dennis Haupt:

I don't want my changes saved to file A when I'm part way through refactoring and have to refer to file B because it leaves my code in an unstable state. I'd rather get it all coded the way I want it before saving a file. Now if part of my refactoring affects multiple files, I may only want to save specific files.

 

I don't see why you're so concerned about use-cases. If it's not something you'd use, don't use it. But it should at least be provided for other people who'd like to use a product they've paid for how they'd like. And as others have pointed out this is a standard way of working in other IDEs/editors, so it violates the principle of least surprise for new users.

 

Why am I on here? To find out whether I've lost the work on my file that was helpfully autosaved when my machine crashed with a weird bug that locks the backspace key. I'm glad I found the local history but it annoyed me that when I opened the browser my file was blank making me think I'd have to revert to a (luckily recent) commit.

Dennis  Haupt Dennis Haupt  says in response to James Hammond:

i just don't see why you would not want your files to be in the same state in your ide and on the hard drive. for auto-deployment this can become a problem, i see that, but autosave without even autocompilation?

if i say "make", i want all my changes to be recompiled, not a random part of them i have to keep track of.

Igor Bljahhin Igor Bljahhin  says:

Autosaving is not working well with Play framework. While I create or edit Play controller and IDEA saves it automatically, Play detects changes and starts to reload the application. After a while Play application crashes with java.lang.OutOfMemoryError: PermGen space.

Ion Ion Ion Ion  says:

I have a custom editor. Is there a way to intercept the save action? I want to do some additional things when a my file is saved.

Dan Dascalescu Dan Dascalescu  says in response to Dennis Haupt:

The argument about auto-compilation doesn't apply to PhpStorm or WebStorm, which deal mostly with interpreted languages.

 

Anyway, the "Save single file" feature has been implmented, as of PhpStorm EAP 7.1. Go to Settings -> Keymap and type "Save". You'll find it under "Other -> Save document". You can assign Ctrl+S to that action, and some other shortcut to Save All.