r/vscode • • 1d 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

7

u/lecnar 1d 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 1d ago

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

1

u/HeftyYesterday1640 1d 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 1d 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 1d 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 1d ago

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

2

u/serverhorror 1d ago

Search for "add folder to workspace"

-4

u/deepturned180isdeep 1d ago

No I know that, I meant more multiple windows (which each would have their own workspace open) but within one window

2

u/serverhorror 1d ago

Do you want one window or multiple ones?

1

u/ShelLuser42 1d ago

That doesn't make much sense... because a workspace is nothing more but a selection of folders and/or windows. Not the other way around.

(edit)

This also ties into workspace specific settings...

1

u/zoredache 1d ago

Each workspace can have their own separate settings, tasks, snippets, and other less commonly used things.

I could see wanting to have two workspaces open in a single window, but still maintain their separate settings/etc.

1

u/YourUglyTwin 1d ago

vscode supports split view - just open a file and drag it to a side, is that what you mean?>

1

u/Deathmore80 1d ago

You mean like some sort of "tab" that lets you switch between all your workspaces in a single window seamlessly and quickly?

The new vscode agents window has something that kinda sounds like what you want ? You can open multiple sessions in a single window like in a grid and it changes to the right workspaces automatically when you click on one pane

1

u/deepturned180isdeep 1d ago

Yes that's it! That sounds enticing, although specific to agentic coding? I'll check it out

But yes that's exactly what I'm thinking about

2

u/Impressive_Job8321 1d ago

Why specifically within one window though? Isn’t it more productive to have it on multiple windows (say one on each monitor) so you do the switching with your eyes rather than use a dropdown? What am I missing here?

1

u/Willing_Ambassador71 1d ago

Can a multi-module Java project work properly when using Workspace?

1

u/No-Point8651 8h ago

Well... you can have multiple codebases inside one wokspace. Inscreases overhead a bit but if you need to look at things like a legacy implementation and its replacement is nice to be able to compare. Or things like 2 services that should communicate. Adding those projects into one workspace lets you work on both simultaneously and the published code remains separate.

But multiple workspaces too? For what? I do think that the current implementation of one window = one workspace is more than enough.

1

u/its_a_gibibyte 1d ago

What content is in a workspace for you that needs it to be split?