15

Let's say I have 2 folders - apple & orange

Now I opened apple in VSCode using code apple.

In the embedded terminal in VSCode, how do I open orange folder in the same instance as apple by overriding it without starting a new instance?

2 Answers 2

9

Support for multi-root workspaces is there.vscode-insiders which support multiple projects at same time.Please refer to our documentation for a full explanation of all the features that come with it. Extension authors should refer to our wiki that explains the new extension APIs to make your extension ready for multi-root workspaces.

You can do it like this:

I just tried in my system it working perfectly fine to open a another folder in same instance

code -r path 

Like: code -r C:\Users\admin\xxxx\xxxx\apple(orange already opened in the same instance)

If you want to open a existing folder in new window from terminal:

code -n Path

Like: code -n C:\Users\admin\xxxx\xxxx\apple(apple will opens in another window and orange also there.)

If you want to open a new tab in same instance by terminal:

code filename.extension (Hit enter then just press ctrl+S and then it saved the file in the same directory).

Thanks for the question.Hope this will match your curiosity B|

Sign up to request clarification or add additional context in comments.

11 Comments

oops i'm sorry. i couldn't decide between workspace & instance so i wrote workspace. i now know both mean different things. i edited the question to reflect that. can u answer again?
If you want to open simply new project or folder in the same instance then all you need to do: Go to FILE>OPEN FOLDER or (Ctrl+K+O).Please let me know if you asking this or I'm getting wrong
No, I want to open it from the command line. Like I do, code . from the folder I want to open. Similarly, I want to do something like code apple/ -something. -something is some parameter which opens the apple/ folder in the same instance. I hope u understood now :)
I understand but i don't understand why you want to do like that because you can able to do that by going FILE>OPEN FOLDER or (Ctrl+K+O).So, it's just a curiosity or it's your need.
just curiosity, not a need. honestly, I open too many VSCode instances many times when I'm coding so I have to open one using VSCode's terminal & close that same instance & then check the new one. Instead, I'd love to open it into the same instance. But it's not that much of a problem. It probably takes me 30 seconds 😂
|
1

@rioV8 suggested this solution: File > Add Folder to Workspace ==> Multi Root Workspace

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.