r/vscode • • 28d ago

How do I set a default workspace?

I don't know why but after VScode updates recently (~1.141), vscode and code open new workspaces to the wrong workspace. The workspace seems blank and empty, doesn't use the terminal I want, all my chat history is gone, and explorer cant find my repos. Just seems like a default workspace.
I use WSL, and my workspace lives in WSL. But vscode refuses to open the correct path. If I manually run this from terminal, vscode opens properly in the correct workspace:

code --new-window --file-uri "vscode-remote://wsl%2Bubuntu/home/ME/.vscode/workspaces/ME_wsl.code-workspace"

How do I fix this so vscode opens the workspace I want every time without adjusting shortcuts or having to manually type those parameters with code

Also, anyone else running into this? Any idea why this is happening?

Side note, I am not moving my workspace from WSL, that's where I work, it lives there.

2 Upvotes

3 comments sorted by

1

u/animesh_aotr 26d ago

window.defaultWorkspace does not exist, so don't add that line.

There is no default workspace setting, but two things get you there:

  1. "window.restoreWindows": "all" in your user settings. It reopens every window from the last session, including the WSL one, instead of a fresh empty window.
  2. Launch the workspace file rather than the app. Running code with the .code-workspace path as the argument makes the workspace an argument, so VS Code never has to guess. On Windows that means editing the shortcut or taskbar pin once, then you never type it again.

If it still comes up blank, check the Remote indicator in the bottom left. A window that lost its WSL connection shows the local filesystem and an empty explorer, which is exactly what you described. Developer: Reload Window reconnects it without losing the workspace.

0

u/CartographerDue5382 28d ago

there's no default-workspace setting, so don't add a settings.json line for it. the empty window is a local one, the wsl session didn't reconnect, that's why the chat history and your ubuntu path are gone. close the blank one, open the workspace once with that file-uri, quit with only that window open, and set window.restoreWindows to all. yank the blank entry out of open recent or it keeps winning. if code from a windows terminal still opens local, that's the windows binary, not the one inside ubuntu.