Reputation: 641
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:
Upvotes: 64
Views: 69864
Reputation: 564
Visual Studio Code, open settings (command ,) on mac, search for "showTabs" and select "multiple".
Upvotes: 1
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
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
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.
Upvotes: 3
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
Reputation: 1
Short answer:
Upvotes: 0
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
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 File → Preferences → Settings, under the user settings.
Paste this code in your user's setting.
"workbench.editor.showTabs": false
Upvotes: 10
Reputation: 153
Please follow below steps:
Menu File → Preferences → Settings. 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
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
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