Sublime Forum

Data is randomly lost, even Data previously saved to disk!

#1

I’v been using Sublime Text 3 (Build 3059) for a while now.

I open the same file several times in parralel to be able to work on several functions that interweave without having to scroll throug thousands of lines.

Suddenly I started getting sporadig windows, promting that “the file had changed an disk” and asking, if I wanted to reload it. This probably began a few weeks ago.

A little worried I aknowledged.

Today I’ve been hacking all day. Somehow I kept getting weird errors and the parts I programmed never seemed to work together. And it seemed like I must have slept very bad, because I kept encountering stuff I could swear I had refactored before. This has happend during the last weeks also, but probably not as often as today.

Now I just realized that lots of my Code seems to have never been saved. When I compare the file with the changes documented in git, I can tell that HUNDREDS OF CHANGES from today have not been saved to disk. On the other side, lots of changes have been saved.

Actually: Changes that had been saved to disk earlier and dokumented in git disappeared later!!!

And today I had thought things were going well because no windows appeared, asking to reload because of changes on disk.

So I am sitting in front of a big Mess and an application that cries “error” left and right.

And worst: I have no Idea how long this has been happening and how I can debug this mess.

I am on Windows 8. The files are on a lokal SSD. As mentioned I work on the same file in several windows parralel. And I often don’t restart the computer but rather let ist “save energy” to be able to quickly pick up where I left.

Looks like I have to change editor.

0 Likes

#2

Hello,

Yes, this is a problem that cause data loss, should be a priority. Open the same file in instances or same instance should always clone a file. I consider this problematic more than helpful. If the API is used to open files, then probably a new parameter to tell if it should a clone (default to true for all use) can be handy.

To workaround the problem meanwhile, instead of open the same file multiple times, just “Clone” the file. In the main menu bar -> File -> “New file into view”. Then later, you can drag and drop the file out to its own window.

Technically you opened multiple files. This means each view does not share a buffer, and when you save, one overwrites the other. To open views/tabs with shared buffers(cloned files) follow what I tell before.

0 Likes

#3

thanks tito

When I wrote “I open the same file several times in parralel”, I meant that I repeatedly choose “File” > “New View into File”.
Only rarely do I open a file with the contextmenu in the file explorer. And usually this is because it is in a folder that is not shown in the file side-bar inside sublime text after I used “File” > “Open Folder”.

I can’t be 100% shure this hasn’t ever happened though.

More often (but not usually) it could have happened that I open a file that was already open by double clicking it in the file side-bar inside sublime text. I tried this out now but: this way you end in an already opened window. So maybe this would not cause any trouble?

0 Likes

#4

There is so many ways to open the same file many times accidentally. IMO a file opened more than once should be always a clone by default. Some time ago, I attempted to fix this with a plugin but you can’t move views from window to window, you may detect if the file opened is not a clone of an already existing view, but no way to move it. I may work into something today to prevent opening files that are not clones.

0 Likes

#5

A bit late but as promised: github.com/SublimeText/PreventFakeClones
Prevents opening the same file twice, if does not share a buffer (ie is not a clone or cloned file)

0 Likes