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

Support to open a project folder in multiple VS Code windows #2686

Closed
2 tasks
weinand opened this issue Feb 3, 2016 · 122 comments
Closed
2 tasks

Support to open a project folder in multiple VS Code windows #2686

weinand opened this issue Feb 3, 2016 · 122 comments
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code workbench-workspace Workspace issues
Milestone

Comments

@weinand
Copy link
Contributor

weinand commented Feb 3, 2016

Currently VS Code prevents opening a folder more than once which makes it impossible to work on a project in multiple windows (e.g. on multiple displays).

@bpasero @dbaeumer @egamma @alexandrudima please raise any obstacles and issues you might foresee with this request.

Issues found so far:

  • we use the workspace path as identifier to communicate back from debug target to debug host
  • we need to verify cross platform that there is no code causing issues when running over the same root folder (e.g. file watchers)

Please note: Initially I've created this feature request for a specific use case: enable debugging of multiple processes.
In the meantime, debugging of multiple processes has become possible without the need for opening a folder more than once (see #13426). But instead of closing this item (as no longer necessary), I've repurposed it by removing the specific debug use case.
For transparency you can find the original comment below:

Currently it is not possible to debug more than one process from a single VS Code project (= window)
because VS Code prevents opening a folder more than once.

The workaround is to open VS code on a subfolder within the original folder, which means to restructure the project (which is not desirable).

This feature request asks for lifting the constraint and allowing to open a project folder multiple times.

@weinand weinand added feature-request Request for new features or functionality workbench labels Feb 3, 2016
@Tyriar
Copy link
Member

Tyriar commented Feb 3, 2016

I think this is a duplicate of #48

@weinand
Copy link
Contributor Author

weinand commented Feb 3, 2016

@Tyriar yes, on first glance this looks like a duplicate. However this request is specifically targeted towards a concrete use case: enable debugging of multiple processes.

I do not want to discuss why this is necessary or what the name of a setting to enable this should be. I just want to discuss what is needed to make VS Code support this scenario without any problematic side effects.

@bpasero is the right person to resolve this as a duplicate of #48 or not,

@bpasero bpasero added this to the Backlog milestone Feb 4, 2016
@bpasero
Copy link
Member

bpasero commented Feb 4, 2016

I think this request is fair because it talks about lifting our current limitation that you cannot open the same folder twice in 2 or more windows.

@weinand I suggest we add the issues we see to your first comment so that we do not have to haunt down all the issues by checking the comments.

@stereokai
Copy link

@bpasero How about this? Is this a feature that a contributor can solve or only core team members?

@bpasero
Copy link
Member

bpasero commented May 10, 2016

This is not an area where we would easily accept PRs, sorry. It needs more thinking than just allowing to open the same folder in multiple windows. People might expect this to be a very light weight operation because the folder is already open in one window. In fact, the 2 windows share nothing and so you end up with multiple language services. I find this OK but not everyone in the team currently would agree to that.

@stereokai
Copy link

@bpasero I understand. Well then, hope this feature comes out soon, would contribute a lot to users with multi-monitor setups

@hackwaly
Copy link

I found a workaround - use ln -s.

@bpasero
Copy link
Member

bpasero commented Oct 13, 2016

Some notes:

  • Distinct user interaction only from File > Open Folder?
  • Show a prompt to warn the user when this happens?
  • How to support API to force open the same workspace in a new window?
  • What does it mean for Window settings or local storage that are associated?

@dbaeumer
Copy link
Member

dbaeumer commented Oct 14, 2016

Additional notes

  • impact on language server which we will start twice on the same workspace

@Tyriar
Copy link
Member

Tyriar commented Oct 17, 2016

Additional notes:

  • The hot exit implementation currently assumes a folder will only ever be opened once, it would need to be tweaked to allow 'duplicate' workspaces

@weinand
Copy link
Contributor Author

weinand commented Oct 17, 2016

FYI:
the debug team is currently working on a solution for "multi target debugging" that does not require to open a project folder in multiple VS Code windows. So we are not relying on this feature request.

@chillinski
Copy link

There has been a release in May which includes a new feature that may help with this. It is not completely the one we are all waiting for, but it is a good step forward.

https://code.visualstudio.com/updates/v1_24#_duplicate-workspace-in-new-window

@jcklpe
Copy link

jcklpe commented Jun 24, 2018 via email

@mateusmedeiros
Copy link

mateusmedeiros commented Jun 28, 2018

The update page says it is "a workaround to the current limitation that one workspace cannot be opened in two windows". How exactly is it a workaround instead of the functionality itself? I mean, isn't it opening a second window within the same workspace?

From what I could test it is pretty much what I needed and it looks like it works quite well, so yay.

Update: Oh, I think I understand it. It doesn't use the same workspace but a copy of the workspace on the same directory. Is that it?

(Nevertheless it is good enough for what I need, which is something akin to tab split on vim, which I use to make a separate window where I can temporarily work on something on a sligthly different context and then go back to where I was in the previous context)

@mikelward
Copy link

@mateusmedeiros Per #48, this issue isn't resolved until

code .
code .

Opens two instances of vscode.

Example use case: I can work on the same project in my local desktop session and my (separate) remote desktop session on the same machine.

@nmccready
Copy link

Honestly, I would prefer it not to do the above behavior by default. Otherwise clicking paths in Iterm will open up a new code IDE for each file which is undesirable.

I would prefer a more explicit intent.

code .
code . --newSession

@mateusmedeiros
Copy link

@mikelward I see, that makes sense. Thanks.

@RoyTinker
Copy link

RoyTinker commented Jun 28, 2018

@nmccready There's a setting to control that: "window.openFoldersInNewWindow".
The default behavior for code . is to open in a new window (this can be disabled using "off" value for the setting).

If I understand correctly, The bug is that code .; code . does not honor this setting if the value is "default" or "on".

EDIT: with the setting set to "off", this behavior can be overridden using the command-line option -new-window; also "on" and "default" can be overridden via -reuse-window.

@nmccready
Copy link

I just tested this with "off" and then used --new-window and it did not work. It opened the same window each time.

@RoyTinker
Copy link

@nmccready sounds like you're reproducing the bug.

@nmccready
Copy link

@nmccready sounds like you're reproducing the bug

right I was hoping we were wrong ;)

@jasonswearingen
Copy link

jasonswearingen commented Aug 26, 2018

A slightly hacky workaround: (using VSCode July 2018) open a new vscode window (ctrl-shift-n) and open the folder above the folder with your project.

doing this (using typescript), I can have:

  • project vscode window as my code editor, and running Watch+Rebuild.

  • "parent folder" vscode window as debugger, running node-dev (or nodemon) for auto-restarting,

this seems to work great enough for me. hope it helps you out.

EDIT: I switched what I do in the 2 vscode windows, so updated the above details accordingly.

@jcklpe
Copy link

jcklpe commented Aug 27, 2018

@jasonswearingen Why not just do this? https://code.visualstudio.com/updates/v1_24#_duplicate-workspace-in-new-window

@jasonswearingen
Copy link

@thedonquixotic you are right, that is much better. Thank you very much I'll use that.

The problem is/was I didn't know that command exists, and trying to open the workspace twice just causes the first workspace window to to be in focus.

It seems that this should be an option from the drop-down menu.

@jcklpe
Copy link

jcklpe commented Aug 27, 2018 via email

@Nowaker
Copy link

Nowaker commented Aug 30, 2018

@thedonquixotic's solution works. But this is so inconvenient to those who don't know about it. Trying to open the same directory should result in just that - a new window with the given directory. Likewise, code -n . from command line should create a new window. This doesn't work currently.

@chriskuech
Copy link

I believe there was a recent "feature" that regressed this behavior, contrary top what is described above.

I open VS Code by cding into my workspace and running code .. This would open the folder/workspace, as opposed to code .\myFile.ext opening the single file without the context of a workspace. VS Code now seems to infer the workspace from the file, so code .\myFile.ext and code . are now equivalent and therefore the workspace would have one window open. This prevents CLI users from opening up a single file in a new window, as users above recommend.

@FernandoMiguel
Copy link

@chriskuech I'm on the nightly builds and I still see the same behaviour.
Do keep in mind that if you already have a workspace open, individual files will open there

Maybe -n can force a word a new empty workspace

@chriskuech
Copy link

Thanks @FernandoMiguel , it seems code -n .\myFile.ext successfully opens a new window containing myFile.ext, even when an existing workspace is open.

@ConnectivityChris
Copy link

Possible workaround that might be useful to anyone wanting to have two folders open is to use Live Share and join your own session.

This allows multiple windows to be open simultaneously (With the only downside being always online requirements)

@bpasero
Copy link
Member

bpasero commented Nov 24, 2018

I would argue invoking our command "Duplicate Workspace in New Window" (see https://code.visualstudio.com/updates/v1_24#_duplicate-workspace-in-new-window) is easier than having to join a live share session?

image

@jcklpe
Copy link

jcklpe commented Nov 24, 2018

Yeah, this issue is pretty much solved, but people keep on skipping all the discussion and don't see that aside from being able to invoke this from CLI, the issue is fixed.

For future generations:
👆☝👆☝👆☝👆

🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
𝗧𝗛𝗜𝗦 𝗜𝗦𝗦𝗨𝗘 𝗜𝗦 𝗠𝗢𝗦𝗧𝗟𝗬 𝗦𝗢𝗟𝗩𝗘𝗗. 𝗟𝗢𝗢𝗞 𝗔𝗕𝗢𝗩𝗘 𝗬𝗔'𝗟𝗟 𝗕𝗘𝗙𝗢𝗥𝗘 𝗬𝗢𝗨 𝗣𝗢𝗦𝗧
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

@microsoft microsoft locked as resolved and limited conversation to collaborators Nov 25, 2018
@bpasero bpasero added this to the Backlog milestone Oct 24, 2019
@bpasero bpasero added workbench-workspace Workspace issues and removed workbench-editors Managing of editor widgets in workbench window labels Jul 21, 2022
@bpasero bpasero added the *out-of-scope Posted issue is not in scope of VS Code label Dec 6, 2022
@vscodenpa
Copy link

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 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 *out-of-scope Posted issue is not in scope of VS Code workbench-workspace Workspace issues
Projects
None yet
Development

No branches or pull requests