You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When opening VS code from the CLI, there is a flag (e.g. "--reset-workspace"):
code . --reset-workspace
Using the flag causes VS Code to open in the workspace/directory but:
It does not open tabs for files open at the end of the previous session.
It clears out unsaved files/backups (and does not attempt to open these in tabs either). That is, the files found in the various backup directories discussed here.
Motivation
This option will make it easy to recover if a workspace gets into a state where resource consumption is so high that VS Code (and the machine) crash.
Recently, I did an erroneous "rename symbol" command that caused 200+ tabs to be opened with unsaved changes. This caused memory and cpu consumption to skyrocket. My machine crashed. That's fine. That happens.
The problem arose in recovering from this state. Once I reboot, I want to re-open VS code in the same directory (i.e. code .). But every time I do that, the same 200+ tabs are going to open and everything crashes again. Trying to open and then quickly close all tabs, etc. wasn't working, either.
I was able to fix things by finding the relevant workspace in ~/.config/Code/Backups/{workspace hash}/file and removing all backups. Once that was done, it was possible to close all open files from the gui.
Feature
When opening VS code from the CLI, there is a flag (e.g. "
--reset-workspace
"):code . --reset-workspace
Using the flag causes VS Code to open in the workspace/directory but:
Motivation
This option will make it easy to recover if a workspace gets into a state where resource consumption is so high that VS Code (and the machine) crash.
Recently, I did an erroneous "rename symbol" command that caused 200+ tabs to be opened with unsaved changes. This caused memory and cpu consumption to skyrocket. My machine crashed. That's fine. That happens.
The problem arose in recovering from this state. Once I reboot, I want to re-open VS code in the same directory (i.e.
code .
). But every time I do that, the same 200+ tabs are going to open and everything crashes again. Trying to open and then quickly close all tabs, etc. wasn't working, either.I was able to fix things by finding the relevant workspace in
~/.config/Code/Backups/{workspace hash}/file
and removing all backups. Once that was done, it was possible to close all open files from the gui.System info
Just in case, here is info about my system:
The text was updated successfully, but these errors were encountered: