While Git or any external tool could have saved me, it’s not my job to ensure the source code does not disappear. It’s not like I’m going to create WIP commits once in every 30 seconds or so, just to be safe.
As a matter of fact I installed this local-history extension. I was expecting some sort of backup/history functionality to be there by default, however.
On top of this, I’d understand if there’s an unsaved buffer which gets lost, but in my case I had saved the file to the disk yet it got erased. I suspect that the save logic does a truncate before a write, and it just so happened to crash in between those two phases.
Therefore, I’d say the save process that Atom has is not atomic (no pun intended). In a well designed system, a file write would write the changes to a temporary file, which is then used to replace the actual file.
In any case, a modern text editor, as they say on the front page, should not lead to me losing my data like this. I understand Atom is not 1.0 yet, so, I suppose it was my fault, but for the sake of soundness, this issue should be resolved.