Hacker News new | ask | show | jobs
by simonw 250 days ago
I had a similar anecdotal experience a few weeks ago.

I was working on a blog entry in a VS Code window and I hadn't yet saved it to disk. Then I accidentally hit the close-window keyboard shortcut... and it was gone. The "open last closed window" feature didn't recover it.

On a hunch, I ran some rg searches in my VS Code Library feature on fragments of text I could remember from what I had written... and it turned out there was a VS Code Copilot log file with a bunch of JSON in it that recorded a recent transaction with their backend - and contained the text I had lost.

I grabbed a copy of that file and ran it through my (vibe-coded) JSON string extraction tool https://tools.simonwillison.net/json-string-extractor to get my work back.

1 comments

Looking back, writing interrupt service routines[1] for DOS as a self-taught teenager has been massively helpful.

Primarly because it taught me to save every other word or so, in case my ISR caused the machine to freeze.

[1]: https://wiki.osdev.org/Interrupt_Service_Routines

Programmer from DOS times here. I've ingrained pressing CTRL + S every few seconds as a reflex. That has saved my bacon more than a few times.
I've started programming later than DOS (probably around win95 or so) but I still have a reflex to hit ctrl-s three times basically any time I stop typing.

You only need to lose hours of work once or twice to learn that lesson!

There's an option now in vscode to autosave every few seconds.
If you can't remember what you wrote a 'few seconds' ago then you have more problems than having to work in vscode!
This doesn't dignify a reply, but the parent comment was about avoiding data loss because of crashes, and the saving is just good hygiene if you’re making frequent commits, formatting on save, etc. one less thing to think about, one less mistake made.
It's called aging. Just wait until the first time you head back down the hall from the living room to the bedroom to get the thing you forgot to bring with you, get distracted for a moment by a pet or family member, and then can't remember if you were going down the hall to the bedroom or the living room.
I have ADHD bro