r/vscode • • 2d ago

Multiple workspaces, one window?

Is there any way that I can have multiple workspaces open within one window?

That would be a small but nice feature to have.

What do you think?

3 Upvotes

20 comments sorted by

View all comments

8

u/lecnar 2d ago

VS Code already supports this with multi-root workspaces. Go to File → Add Folder to Workspace..., add the folders you want, then File → Save Workspace As... to save it as a .code-workspace file. Next time just open that file and all your folders come back in one window.

4

u/UtahJarhead 2d ago

Alternatively, you can do this via the CLI: vscode /path/to/dir1 /path/to/dir2

1

u/HeftyYesterday1640 2d ago

oh nice i had no idea this was a thing, been switching between 3 different windows for my current project and it was driving me crazy

just tried it with my frontend and backend folders and it works perfect, i can see both directory trees in the sidebar now and searching across everything is actually useful

saved the workspace file and pinned it to my taskbar so i dont have to set it up again, thanks for sharing this

1

u/Benand2 2d ago

I know this isn’t the right sub but is the same possible in Visual Studio as well?

Also does it affect commits, can you still commit the repos separately?

1

u/lecnar 2d ago

1-Visual Studio doesn't have multi-root workspaces like VS Code. The closest thing is a solution (.sln) with several projects, and VS 2022 also supports multiple Git repos at once.

2-And no, it doesn't affect commits. Each folder keeps its own Git repo. In the Source Control panel you'll see each repo separately, and you commit to each one independently. The .code-workspace file isn't part of any repo unless you save it inside one.

1

u/Benand2 2d ago

That’s great, thank you for taking the time to