Native New Yorker
Native New Yorker

Reputation: 641

How can multiple files be opened in Visual Studio Code (VSC)?

How can multiple files be opened in Visual Studio Code (VSC)?

For some reason, my copy of Visual Studio Code can only open one file at a time. For example, if there are two files in the workspace folder, let’s say an HTML and CSS file, both cannot be opened simultaneously. If one file is open, clicking any other item in VSC's file explorer will replace the current file. VSC will not open the other file in a new editing tab.

I am not concerned with running multiple instances, Workspaces or folders of VSC. I just want to open two files in the same folder. Is there a configuration setting controlling this? Or is this the result of upgrading to the latest version of VSC? Is just a "new feature" of VSC?

It's seems ridiculously simple, but I need help. I am running Visual Studio Code v. 1.24.0 for Windows 10 64 bit.

Visual Studio Code screenshot:

Enter image description here

Upvotes: 64

Views: 69864

Answers (12)

Jason Spence
Jason Spence

Reputation: 564

Visual Studio Code, open settings (command ,) on mac, search for "showTabs" and select "multiple".

Upvotes: 1

codegal
codegal

Reputation: 21

  • Go to Setting

  • type 'json' in the search box

  • under 'Launch', click on "edit in setting json"

  • then change the workbench.editor from false to true shown below.

    "workbench.editor.showTabs": true,
    "workbench.editor.enablePreview": true
    

Upvotes: 2

Ishmeet Arora
Ishmeet Arora

Reputation: 31

Try the three dots on the upper right hand side corner, right beside the icon for splitting the editor.

From the drop down, check if the option keep editors open is enabled. If not, enable it.

Upvotes: 3

Jay Patoliya
Jay Patoliya

Reputation: 33

Just double-click on files to open in new tab.

Upvotes: 2

origamifreak2
origamifreak2

Reputation: 193

If you Ctrl + click or Shift + click and highlight all the files in the sidebar, then you can click and drag them all to whatever area of the editor you want.

Visual Studio Code open multiple files

Upvotes: 3

Anuj Singh
Anuj Singh

Reputation: 106

Go to 'settings' in Visual Studio Code and search for 'preview'. Then on the second position from the top you will find "Workbench › Editor: Enable Preview". Simply untick it and your problem will be solved.

In this GIF you can see it's working properly.

Upvotes: 6

Vara Prasad
Vara Prasad

Reputation: 1

Short answer:

  1. Double-click on the file. (or)
  2. Ctrl + K + Enter and single-click on the file.

Upvotes: 0

Abhilash Ramteke
Abhilash Ramteke

Reputation: 436

Double-click on the file and it will be opened permanently in the Visual Studio window until closed manually.

If you single click on the file, then the file can be replaceable if some other file is opened.

Upvotes: 1

Yashu Mittal
Yashu Mittal

Reputation: 1666

Visual Studio Code, by default, keeps this option enabled to open a file in a temporary file. This feature comes in handy when you want to just take a look at some code.

If you want to open a file in a new tab, just double click on the tab or double click on the folder you want to open from explorer or once the file is opened press the shortcut key Ctrl + K + Enter.


You can even disable this option in menu FilePreferencesSettings, under the user settings.

Paste this code in your user's setting.

"workbench.editor.showTabs": false

Upvotes: 10

dkm007
dkm007

Reputation: 153

Please follow below steps:

Menu FilePreferencesSettings. Now you will see USER SETTINGS and WORKSPACE SETTINGS.

Click on WORKSPACE SETTINGS. Now search for workbench.editor.showTabs and change its value to true.

I tested this by turning it false and it restricts from opening multiple files in tabs. When it's false, whenever you open one file, only that file will be opened and the earlier file gets closed.

When set to true, you can open as many files you want and all files will be a new tab.

Upvotes: 8

Lukas Bach
Lukas Bach

Reputation: 3909

In Visual Studio Code, if you click once on a file, it opens it in a temporary tab. This is helpful if you are looking into a bunch of files searching for something, without opening every single one of them.

If you want to open a file in a new tab that persists until closed manually, double-click on the file.

You can also persist a tab that was previously created as a temporary tab by double-clicking on the tab. Note that temporary tabs have an italicized title, while normal tabs do not.

Upvotes: 86

foxsimile
foxsimile

Reputation: 341

Others have mentioned double-clicking the file in order to open it, however, I will suggest an alternative approach:

Within your settings, under workbench, set:

"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false

This will allow you to open the files with a single click, as opposed to double-clicking. It may seem minute, but it was incredibly annoying to have to double-click every single file.

Upvotes: 34

Related Questions