Stop Pycharm from auto-closing files without prompting
Is there any way to stop PyCharm from closing tabs for files that it believes no longer exists?
Looks like if a file is open, but then isn't accessible because things like: The file was deleted; the file was renamed; the file is on a network share that is unmounted or temporarily unavailable, etc...PyCharm will immediately close the tab without notification or prompting.
In my case the problem comes up because I'm storing a project on a network share (NFS) and for any number of reasons - usually because of something that lasts only a couple of minutes - the share might be unavailable and PyCharm thinks the file no longer exists. If so, the files are usually immediately closed.
If the file has been modified, I may or may not get an error saying it can't save a temp file. But more often it gives nothing; just closes the tab and my changes are lost.
I know PyCharm can ride through my particular situation. It's not the fact that the filehandle is closed or something that causes a problem. If I open a file, then umount/remount the NFS mount (which forces FH close to PyCharm), PyCharm is fine as long as I've left it in some dialog window (like exit confirmation or preferences). It looks like the closing is some intentional behavior as the result of some kind of directory watcher or project scanner or something that kicks off. So I'm hoping can be disabled.
If nothing else it'd be better if it prompted before closing, and if there are unsaved changes, gave an option to re-save to an alternate location.
Please sign in to leave a comment.
5 years later, still an issue
I think this just happened to me, again. I looked up and a bunch of files that were external to the project …. just closed. Cos yes that's what I wanted.
I know you can open ‘scratch’ files but I don't want to. I'll see if adding these explicitly to the project fixes anything.
Is there a way to stop this behavior?
Changing branches in git for example to update dev branch, switch back to then merge back into my branch to keep it up to date with dev. However, it just closes all the files I was working on.
I'd much prefer it show a big X saying the file was deleted but not close it so that when I quickly reopen the branch I can keep going.