Dr-Nuke
Dr-Nuke

Reputation: 388

VSCode: “~$ code file” opens new window instead tab

In a Terminal within VSCode, when I type

~$ touch deleteme.file
~$ code deleteme.file 

a new VSCode windows opens up (with considerable loading time), instead of opening the file in a tab of the current window. How can I fix this?

I have the same behavior on

~$ code -r deleteme.file or

~$ code --reuse-window deleteme.file

[duplicate from this prematurely closed question]

Upvotes: 3

Views: 204

Answers (2)

dopexxx
dopexxx

Reputation: 2636

The solution to this depends on your current location in the terminal, but the general answer is :

code -r deleteme.file path/to/root/of/vscode/window

In case your terminal is already in the root of your VSCode folder, this will do the job:

code -r deleteme.file .

The trailing path specifies where VSCode will search for existing windows. But beware that if your path does not point to the root of the current VSCode window, you will overwrite the current window (including all tabs) with a new window that just opens deleteme.file.

Upvotes: 0

Dr-Nuke
Dr-Nuke

Reputation: 388

Reinstalling VScode was the solution.

Upvotes: 1

Related Questions