How to stop VScode reverting my changes after save

Question:

I have a super tedious issue with VSCode (run in POP!) wherein it will revert my changes back a few steps after I save or if I leave the code pane open for a while without any typing. I only use VScode for Python and the only extension I have is ‘Python’ by Microsoft.

This is an issue because my current project has numerous modules some of which have many lines of code and when VScode makes random reverts it sometimes takes time to find why my code no longer runs.

Some other information:

  • If I am watching, I can see the code changing
  • I recently figured out I can ctrl-z the reverts back to my code if I
    haven’t changed panes

What am I missing in VScode which may do this?

EDIT: For this given project, all my files are stored in my SpiderOak Hive (folder synced across a few computers). I think the problem may have to do with the syncing software pushing the updated file to the other synced computers. But that is just my working theory right now. I’m testing it against local python files, which is also tough, because typing meaningless python code is tedious.

Asked By: Boerjie

||

Answers:

So, the issue derived from the SpiderOak sync. I don’t know the mechanics of it, but depending on when I saved a file in respect to a periodic sync led to the revert or not.

Answered By: Boerjie

Heads up in case this affects anybody else I had a similar issue. Save would format or revert all of my changes depending on how I launched VS Code. Just typing code on the cli the whole thing worked fine. Clicking VS Code icon in favorites (Linux env) stood up a VS Code that reverts on save. Super annoying. Turns out the icon had extra args that were causing this. I have no idea who put them into the packaging but I removed them: args: --unity-launch %F

Make sure to wipe all args and just try a direct run of Code if you hit this. Frustrating.

Answered By: BoeroBoy
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.