Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode showing only one file in the tab bar (can't open multiple files)

I hit some shortcut and I can't find the setting the turn it off. But opening multiple files doesn't show different tabs.

Here's what I'm seeing

enter image description here

But this is what I'm expecting when I open a new tab

enter image description here

like image 543
Tolga E Avatar asked Feb 02 '18 19:02

Tolga E


People also ask

Why multiple files are not opening in VS Code?

If VS Code doesn't allow you to open multiple files, the issue most likely lies in the program settings. To fix that, do the following: Launch VS Code, then click “File” at the upper part of the program window. Select “Preferences.”

How do I see all open files in Visual Studio 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 I open two files in VS Code side by side?

Side by side editing# Ctrl+\ to split the active editor into two. Open to the Side (Ctrl+Enter) from the Explorer context menu on a file. Click the Split Editor button in the upper right of an editor. Drag and drop a file to any side of the editor region.


17 Answers

Check User interface / Tabs. You just need to add the following line in the configuration file.

"workbench.editor.showTabs": false

I also think that How do I disable tabs in Visual Studio Code? is asking the exact opposite of what you are asking.

like image 123
dstrants Avatar answered Oct 20 '22 00:10

dstrants


On a mac, if both of the existing answers didn't work, you can try command + ctrl + w, worked for me.

like image 28
Divyanshu Kalra Avatar answered Oct 19 '22 23:10

Divyanshu Kalra


try command + ctrl + w in Mac, it works fine

like image 43
neeraj-dixit27 Avatar answered Oct 20 '22 00:10

neeraj-dixit27


The accepted answer didn't work for me for some reason. The answer given in Open files always in a new tab did.

In short: In the menu bar, click on File > Preferences > Settings. Then add the following line to the settings file.

"workbench.editor.enablePreview": false
like image 37
Reid Avatar answered Oct 19 '22 23:10

Reid


This feature is toggled with the command “View: Toggle Tab Visibility”. Internally, it is known as workbench.action.toggleTabsVisibility.

On MacOS, the default keybinding is command + control + w, which is dangerously close to the OS’s "Lock Screen" command command + control + q. (Hitting this accidentally while trying to lock my screen is how I got here!)

On Linux, the default keybinding is meta + control + w

On Windows, the keybinding used to be win + control + w, but it looks like they removed it. See these github issues:

  • Windows key in default keybindings on Windows
  • Add toggleTabsVisibility to keybinding actions
like image 25
Noach Magedman Avatar answered Oct 20 '22 00:10

Noach Magedman


By mistake i tap on mac ctrl + command + w button on visual studio code then open file tabs hide.

Then i tap same button Ctrl+ Cmd + w then its again shows

like image 45
Vivek Singh Avatar answered Oct 20 '22 00:10

Vivek Singh


VSCode Extension: Wrap Console Log use Ctrl + Alt + W to wrap

VSCode use ^ + ⌘ + W to Toggle Tab Visiblity

VSCode use ⇧ + ⌘ + W to Close Window


It's easy to make mistakes 😂.

like image 29
Jon Avatar answered Oct 20 '22 00:10

Jon


As of the most recent update, in my VSC, you have to double-click the file icon to get a new tab.

And this just when I was finally getting used to clicking ONCE in the older version. I mean, I get "push out a new feature set ASAP" if Microsoft wants to compete with F/OSS, but haven't they heard of POLA ... and not breaking it?

like image 35
Kevin_Kinsey Avatar answered Oct 20 '22 01:10

Kevin_Kinsey


On VsCode version 1.64.2 , do the following :

  1. Open VsCode settings and search for "Show Tabs", like shown in this screen shot:enter image description here
  2. Check and select the option for "Show Tabs" as pointed.
like image 34
Alferd Nobel Avatar answered Oct 20 '22 01:10

Alferd Nobel


For mac, if your tab close icon disappears and showing every page in a new tab just press (as shown in image).

enter image description here

Command + Control + W

or

⌘ + ^ + W

It will appear your tab icons (as shown in the picture).

enter image description here

like image 44
Habib Avatar answered Oct 19 '22 23:10

Habib


This is a "feature" albeit a confusing one of Visual Studio code called the "Preview" tab!

I know I struggled with it until I took the time out and searched here for an answer!.

Normally you can single-click on a file and open it in a preview tab, go over it and move on to the next one. This can be handy when you've opened a folder and quickly want to go through the files therein.

However, it is confusing when you're actually working on files. The simplest solution is to double-click on a file in the explorer tab, this opens up the file in it's own separate tab.

IMHO, an alternate approach to disabling the feature, is getting used to this "default" setting of a preview tab, rather than turning it off in settings and later on, when you re-install it or go to another machine, struggling with "Ahh...I knew I did something to disable this behaviour!".

If this thought process doesn't work for you, you can always do what's suggested in the other answers.

like image 40
Bharat Mallapur Avatar answered Oct 19 '22 23:10

Bharat Mallapur


Go to Preferences -> Settings -> UserSettings -> Workbench -> EditorManagement
check "Show Tabs" . Tabs will appear immediately .Enjoy

like image 40
deva11 Avatar answered Oct 20 '22 01:10

deva11


Follow this,

Go to Preferences -> Settings -> UserSettings -> Workbench -> EditorManagement
check "Show Tabs"

and Restart, Enjoy (y)

like image 31
Sam Avatar answered Oct 20 '22 00:10

Sam


This error happens because workbench.editor.showTabs is set to false. Open the Settings.json Press cmd+Shift+p and then type Open Setting and hit Enter

In the settings.json file add this line at the bottom.

"workbench.editor.showTabs": true

like image 40
Vishweshwaran Avatar answered Oct 19 '22 23:10

Vishweshwaran


This has nothing to do with setting workbench.editor.showTabs:true.Just double click on the file you want open in new tab and it will VS Code will open it for you in new tab.

like image 26
olammy Avatar answered Oct 20 '22 01:10

olammy


If you still feel you have this problem it could be that "Preview Mode" is enabled. The title of the tab will be in italics, meaning it is in preview mode and the same tab will be used when you open the next file, unless you start modifying the file.

Go to settings and find "Workbench > Editor: Enable Preview" and deselect it. Now every file will be opened in a new tab.

like image 23
Henk Kruger Avatar answered Oct 20 '22 00:10

Henk Kruger


In latest visual studio code , by double clicking on any of the file in file explorer will open in new tab. It assumes single click as a file preview option and many people get confused with it.

like image 45
Ambuj Kumar Avatar answered Oct 20 '22 01:10

Ambuj Kumar