Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up VS-Code to open new files in current instance?

Tags:

So I've been using Visual Studio Code recently and I really like it. However, every time I open a file, a new window will open rather than a new "tab." I've already tried setting window.openInNewWindow to false and that doesn't work.

like image 638
jagmeetb Avatar asked Jan 21 '16 23:01

jagmeetb


People also ask

How do you open a new file in VS Code?

VS Code provides two powerful commands to navigate in and across files with easy-to-use key bindings. Hold Ctrl and press Tab to view a list of all files open in an editor group. To open one of these files, use Tab again to pick the file you want to navigate to, then release Ctrl to open it.

How do you open VS Code in current directory?

If you already have a Terminal session running, quit or restart it. When you are in the directory of the files you want to open in VS Code, type code . (that is the word “code” followed by a space, then a period) and the folder will automatically open in VS code.

How do I open multiple files in VS Code?

Launch VS Code and press the “Ctrl” and “P” keys simultaneously to search for a file to open in the current project. Type in the file name. To open the new file in a temporary tab, click on it once. To open the new file in a separate window that you can choose to close manually, double-click it.


2 Answers

Edit regarding VSCode 1.9.0

The VSCode team has changed the default settings since 1.9.0, it should now be the default behavior. If VS Code is still not reusing the same window, you can enforce this behavior with:

"window.openFilesInNewWindow": off

They have also extended the settings available to configure those behaviors (see release note here).

Original answer

This is currently supported by the latest version of VSCode and solution is detailed in this SO post.

Simply add the following setting to your user setting:

"window.openFilesInNewWindow": false

Tested and approved with VSCode 1.4.0 :)

like image 113
GGirard Avatar answered Oct 12 '22 23:10

GGirard


Updated answer since 1.11:

"window.openFilesInNewWindow": "off" 

Accepted values are now "on" "off" "default"

like image 35
jaminroe Avatar answered Oct 13 '22 01:10

jaminroe