PhpStorm "Save as" open new file - intellij-idea

This always catches me out, but it appears to be another PhpStorm only quirk. Normally when you "Save as" a document, it will open the new file. This happens in all Adobe products, all Office products, and every other app I can think of... except PhpStorm.
So many times I've forgotten about this quirk and started working over the old file, thinking it was the new one. It's most frustrating.
Is there a way to change this behaviour?

Is there a way to change this behaviour?
Unfortunately no.
Save as is basically a shortcut for Save and then Refactor | Copy.
https://youtrack.jetbrains.com/issue/IDEABKL-332 I guess (based on "duplicate" tickets)
General suggestions (Captain Obvious):
Invoke Refactor | Copy on desired file before making changes in it (so it will sit deep in your mind that the currently edited file will keep changes)
Use Local History to rollback unwanted changes in old/original file.

Related

Intellij any way to turn off overwrite confirmation?

Given the power of intellij, one would think disabling the overwrite file confirmation popup is possible. It appears after right-clicking a file in the Project Tool window, clicking copy, and clicking paste anywhere a file with the exact same name exists:
I could find no specific setting to do it. Ideas? (pun intended)
Since it's a potentially dangerous operation, IntelliJ IDEA doesn't provide an option to skip this dialog. When overwriting multiple files, there will be an option to do it for all files at once.

In Intellij IDEA how do I reload file content's from disk?

In vim I can type :e and reload a file's contents from disk overwriting any changes I've made. It's a nice way to reset in case I've gotten lost or just want to undo all my changes. This obviously doesn't take into account any kind of refactoring, I just want to nuke all changes to buffer. Not even closing and reopening a tab will work.
How do I do this with Intellij IDEA? I'm using Intellij IDEA Ultimate 13 and I've disabled any kind of auto save.
File > Synchronize (Ctrl+Alt+Y)
It will load the file from the file system. If you have unsaved changes, it will ask if you want to discard them.
⌥⌘Y - Synchronize for Mac users
What I do in a similar situation:
Simple - Ctrl+Z, Ctrl+Shift+Z many times to quickly navigate the editing history
VCS rollback - either for the whole file or for the area being edited (by clicking green areas on the left)
Local History. Well, yes, for you case it's granularity is not sufficient, so first might be an option
There is also an option to put a label into Local History if you need to rollback to a specific point in time.
For those who use autosave - it is being triggered when code editor loses focus. So doing Alt-Tab during long editing without compiling or running the code makes sense.
Open the file in another editor, make an insignificant change and save it. PHPStorm will ask you what to do because the file system and in memory copies of the file have diverged. Click "Load File System Changes".
Note, I was unable to use my undo history as it had become corrupt.
Since what I want isn't really possible I wrote an extension to do it for me:
https://github.com/btipling/DiskRead/
I'll add it to the Jetbrains plugin repository, it's called "DiskRead".
I wrote a blog post about how I created this if anyone is curious.

How to see a list of new non-version controlled files in IntelliJ

So I add new files to my project. At this point IntelliJ pops up a dialog asking me if I'd like to add these files to git/mercurial/svn etc.
I will always say No at this point because until I've fleshed the files out a little, perhaps got them to work with some context, perhaps decided to rename them, I'm not happy to add these new files to version control. Even if I can still rollback the 'add', I have to bare in mind the nuts and bolts of the underlying system. It's safer simply not to do it.
Now I'm ready to commit, I bring up the commit dialog box and the new files are nowhere to be found! If I go on a scouting expedition for them, I can add them individually from project files but this is error-prone.
How do I automatically get a list of all my new files which I previously delayed adding?
I found it, under the changes tab. I was looking for it only under the version control context menu from project files.

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?
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 (*)
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
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

Save Aptana Studio 3 project explorer state on close

I'm sure there is a simple option for this but I have as yet been unable to find it. Every time I close and reopen Aptana Studio 3 it collapses all the folders in the project explorer and I have to reopen them all, is there a way to get it to leave them open and save the project explorer's state when I close the program?
Thanks.
I cannot find any way to keep the state of the Project Explorer. However, using the App Explorer, the state of your open folder will be preserved. You can also try the "Navigator" which looks just like the Project Explorer, but appears to keep state. I will add the proviso to that: It kept state when I restarted aptana, but it also developed a GUI glitch where it appears to be scrolled to the right so I only see the right half of all of my file names and I cannot fix it, so this may not be a good option if you get the same glitch.
There is also a method which does not do quite what you ask, but may be a good fix for you anyway. If you click "Link with Editor" picture (two yellow arrows) in the Project Editor, it will automatically expand your project hierarchy to match whichever open file you have active. Since your files stay open when you close Aptana, this would keep the Project Explorer expanded to whatever you are looking at even on restart. See this question
You can also set up working sets for various parts of your code that are buried in the hierarchy and use the Project Explorer to show those working sets instead of you projects. This does not save state, but it does give you easy access to common parts of your code that may be deeply buried.
Hope one of these helps you.