ghiboz
ghiboz

Reputation: 8003

re-open vscode without last workspace or last files

I wish set VSCode to be launched clean, no last workspace or last files opened.. is this possible?

I use it as unity3d debugger and annoying me all the times that opens a previous workspace (no workspaces saved)

thanks in advance

Upvotes: 15

Views: 9717

Answers (3)

tgreen
tgreen

Reputation: 1926

None of the other solutions were working for me.

Recently hit this issue where I tried to do a find and replace with 15000 files and vscode crashed while trying to save all those files. I closed the window and re-opened but it kept trying to re-open those 15000 files and would crash again.

I was able to fix this by deleting the corresponding workspace folder (search by folder name) in

/Users/{username}/Library/Application Support/Code/User/workspaceStorage

Then when you reopen that folder nothing is saved or open.

Upvotes: 3

Mark
Mark

Reputation: 181050

Besides my comment above, also see open a new window, v1.22 released today if you prefer to open via a command line.

Controls if a new empty window should open when starting a second instance without arguments or if the last running instance should get focus. // - on: open a new empty window // - off: the last active running instance will get focus // Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).

  "window.openWithoutArgumentsInNewWindow": "on"

But the setting

"window.restoreWindows": "none"

should also work for opening in other ways (but seems to require a few restarts - perhaps it has been fixed as of 1.22?).

Upvotes: 17

v.karbovnichy
v.karbovnichy

Reputation: 3306

According to the VSCode command line documentation, you can use -n or --new-window flag to open new session without any old files.

I just checked and it works.

The full command to run VSCode is (on my PC):

"C:\Program Files (x86)\Microsoft VS Code\Code.exe" -n

or just

code -n

Tip: You can change the shortcut for VSCode to include the -n flag so it opens new session always.

Upvotes: 9

Related Questions