Enforce reload of changed files.

From time to time, i find myself opening files in a project, that imidiately after opening them, wants me to reload changed made to that file. Somehow a difference is registered between versions on disk and in memory, but the file has been closed (or not yet opened for the particular issue at hand), and thus should not be stored in memory.

Is it possible to enforce "fully" loading a file, expiring content stored in memory or at least preventing me from changing a file, that supposedly already is changed on disk?

5 comments
Comment actions Permalink

Hi there,

1) Do you have "Synchronize files on frame activation" option enabled (Settings | Appearance & Behaviour | System Settings) ? What about other saving/sync options from there?

2) With the above option enabled, the file from the disk will be used with no extra questions as long as file in IDE has no save pending on that file (was modified but not saved yet). With such option disabled the yellow bar with "Reload" link will be available. Comparison is done by file size+timestamp and not content.

3) If file is modified in both IDE  (but not yet saved) and file system .. then IDE will show "File Cache Conflict". Here you have to choose what version to use as both sides have been modified. I do not know any option that would enforce external change over unsaved editor automatically.

0
Comment actions Permalink

Hey Andriy,

I have "Synchronize files on frame activation" turned off, as I work on files placed on a network share. Turning it on, in a setting like that, kills performance. Nothing in the "Syncronization" section is turned on.

It happens only when I open files. I might have had them open before, but they're closed again. My expectation when opening a file, is that no matter if I have had it open at som point (maybe even edited it, but decided not to save changes), the file comes from closed, reset state, and should not be cached or stored in memory.

I frequently open files, and start working on them right away, just to discover that, even though I just opened them, they're in a changed state, and I need to copy my changes, reload the file and apply my changes again. Granted - I often miss the warning (yellow bar stating "Files changed on disk. Reload"), that do show up, but even with that on I'm allowed to make changes to the file, before the conflict is solved. This may be intended behaviours, but for me it's counter intuitive that a file is not loaded exactly as it is saved or that I'm allowed to change a file with an unresolved conflict. What I would like, is an option to turn either of these behaviours off (preferably the first), as I can't imagine any opening of files, where I'd want anything else than, exactly what's stored on disk, or the headache of resolving a conflict, after further changes are made.

0
Comment actions Permalink

Well ... I do not know any other setting (if there is any hidden) that would help you here with your current settings.

I may only suggest to submit a Feature Request ticket to the Issue Tracker (but first for possibly already existing tickets first here: IDEA, IDEABKL).

maybe even edited it, but decided not to save changes

In case if you do not know: closing file without saving or reverting changes does not mean that those changes will be discarded -- they are pending and will be saved on next Save Documents action call (which may happen any moment: e.g. when you execute command in built-in Terminal or accepting changes in Settings screen).

0
Comment actions Permalink

Ok. Thanks for answering, anyway. I'll look into making a feature request.

I didn't know about pending saving - this could actually be the root of my problems. Any chance of disabling that?

0
Comment actions Permalink
I didn't know about pending saving - this could actually be the root of my problems. Any chance of disabling that?

No.

Autosave is one of the core features (lots of logic depends on it) and there is no plans to remove/disable it.

https://youtrack.jetbrains.com/issue/IDEABKL-6460 -- you can check some comments there and related tickets.


P.S.
"Settings | Editor | Editor Tabs --> Mark modified files with asterisk" -- in case if you did not have it enabled yet. This will allow to see current file modification state (modified in editor or not).

You can use Local History functionality to quickly rollback current file (or any folder/files selected in Project View) to any of the previous saves.

0

Please sign in to leave a comment.