Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Reset workspace" CLI option #147859

Closed
michaelwooley opened this issue Apr 21, 2022 · 2 comments
Closed

"Reset workspace" CLI option #147859

michaelwooley opened this issue Apr 21, 2022 · 2 comments
Labels
feature-request Request for new features or functionality workbench-state UI state across restarts

Comments

@michaelwooley
Copy link

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:

  • 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.

System info

Just in case, here is info about my system:

Version: 1.66.2
Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:49:24.808Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Linux x64 5.10.105-1-MANJARO
@bpasero bpasero added the workbench-state UI state across restarts label Apr 21, 2022
@bpasero
Copy link
Member

bpasero commented Apr 21, 2022

Prior art: #130510, #63668, #22613

@bpasero bpasero added the feature-request Request for new features or functionality label Apr 21, 2022
@bpasero bpasero removed their assignment Apr 21, 2022
@michaelwooley
Copy link
Author

@bpasero thanks - I somehow missed those issues when I was searching earlier. Closing.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality workbench-state UI state across restarts
Projects
None yet
Development

No branches or pull requests

3 participants
@bpasero @michaelwooley and others