452

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

Tolga E
  • 12,188
  • 15
  • 49
  • 61
  • I had something where none of the files were showing when I'd open a folder. I posted question at: https://superuser.com/questions/1628804/why-does-visual-studio-code-vsc-display-nothing-when-i-open-a-folder-containin – raddevus Feb 24 '21 at 22:23
  • I never though they will make me to search for solution on "How to open files in separate tabs in editor", in 2022. But here we are. Welcome to VS Code. – Atul Jan 25 '22 at 05:24
  • This is enough activity on this question that I filed a bug and they removed this binding for macOS, at least in the Insiders build! Hope it makes to release! https://github.com/microsoft/vscode/issues/147310 – Jim Apr 26 '22 at 23:19

32 Answers32

604

Check User interface / Tabs. You just need to add the following line in your settings.json 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.

starball
  • 20,030
  • 7
  • 43
  • 238
dstrants
  • 7,423
  • 2
  • 19
  • 27
  • 38
    In VSCode, click Manage (is the gear shown at lower-left corner) > Settings > in the search bar on top type "showtabs" to get to the right menu > check-marked means tabs will show. – Echeban Nov 10 '19 at 15:14
  • 15
    Seriously tired of finding such little hacks. Thank you very much. I don't understand why default setting is turned off? who on this earth do not want to see files in tabs? – Atul Feb 07 '20 at 15:02
  • 90
    @Atul On Mac, I found that accidentally pressing Ctrl + Cmd + W toggles this behavior and this was most likely what was hurting me as Ctrl + Cmd + Q is used to lock the screen. Maybe something similar is happening to you? – ankush981 Feb 28 '20 at 08:58
  • 3
    @ankush981That's exactly what I did; was trying to hit Shift-Cmd-W to close the window and fat-fingered it. – Eric Pohl Aug 06 '20 at 13:48
  • 2
    @ankush981 Thanks man pressing those keys again fixed it for me – Farhan.K Sep 05 '20 at 00:17
  • 1
    Fixed using Ctrl + Cmd + W. Thanks – Amith Dissanayaka Jan 06 '21 at 07:19
  • 1
    Can't believe false is the default – Brian Schermerhorn Jan 14 '21 at 15:29
  • It seems my setting got changed maybe after upgrade. Because it worked well before. And suddenly, it failed to load more tabs. It is so weird. – 4t8dds Jul 02 '21 at 08:20
  • Just in case the given solutions wont work, click on the elipses (...) in the editor window and select/enable "Keep Editors Open" option. – gvatreya Jul 07 '21 at 16:09
  • Previously, I already had "workbench.editor.showTabs": false within my settings.json. Despite so, the problem still exists. Not sure why. Instead, Echeban's answer worked for me. – Han Aug 24 '21 at 03:46
  • This works "workbench.editor.enablePreview": false – viru May 14 '22 at 18:26
  • I also posted this as an answer, but it appears many are still frustrated. If you still feel you have this problem it could be that "Preview Mode" is enabled. It is for me with every new installation of VS Code. 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. – Henk Kruger Feb 14 '23 at 09:23
588

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

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Divyanshu Kalra
  • 6,420
  • 1
  • 15
  • 17
  • 11
    Works on windows too (ctrl + w) – user2978241 Aug 30 '18 at 04:01
  • 4
    Works on Linux as well (ctrl + w) – Chathuranga Chandrasekara Sep 09 '18 at 15:26
  • 1
    why does this work? what does this shortcut do? I worked for me too! – Shardul Mar 14 '19 at 17:11
  • 1
    worked for me as well! probably pressing this key combo was the reason to disable the tabs somehow. cheers! – krankuba Apr 26 '19 at 09:49
  • @DivyanshuKalra Yep, did the same thing I think. That's why I'm here, because I couldn't figure out why I was only getting one tab at a time. So annoying! – IceMetalPunk May 07 '19 at 20:16
  • ...a disclaiming side note: this works only once. do not try to reproduce. I am now stuck back in single-tab mode – Superole Aug 13 '19 at 13:48
  • 1
    ...and a final update from me on this issue: try Reids answer instead. The setting "workbench > editor > enable preview" is documented as: "Controls whether opened editors show as preview. Preview editors are reused until they are pinned (e.g. via double click or editing) and show up with an italic font style." – Superole Aug 13 '19 at 14:07
  • @Superole It works always, I just checked, you can switch back and forth (between tabs and no tabs mode) as many time as you want on visual studio code. – Divyanshu Kalra Aug 13 '19 at 19:35
  • @DivyanshuKalra maybe I was a bit hasty in my commenting. I meant to refer to the Windows equivalent of your answer as mentioned by user2978241. I did not try your answer on a mac. – Superole Aug 15 '19 at 07:36
  • 26
    This keystroke corresponds to the command "View: Toggle Tab Visibility". On a Mac, it is too similar to command+control+q, the system "Lock Screen" command (which is how I got here!) – Noach Magedman Sep 08 '19 at 10:04
  • I accidentally entered cmd + ctrl + w and I was going crazy what the hell happened. Until I saw your answer. Thank you! – marknt15 Mar 05 '20 at 07:38
  • Awesome, so this is what many of us who fell into this issue probably accidentally typed – Laszlo Sarvold Jul 03 '20 at 07:42
  • I know this was the way I accidentally disabled my tabs as command + ctrl + q locks the screen, which I frequently use. It's very easy to hit the "W" instead of "Q". – Casey Gibson Jul 07 '20 at 04:38
  • Thanks man , it worked - tiny issue but was causing a lot of discomfort. – Dheeraj Jun 28 '21 at 10:46
142

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

Machavity
  • 30,841
  • 27
  • 92
  • 100
neeraj-dixit27
  • 2,812
  • 2
  • 15
  • 6
141

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
apaderno
  • 28,547
  • 16
  • 75
  • 90
Reid
  • 3,170
  • 2
  • 23
  • 37
  • 20
    Only this other question's answer solved it for me. In short: double-click (Open) rather than single-click (Preview). – EliadL Oct 11 '18 at 11:27
  • This just saved me from not being able to compare scripts! Thank you! – mathguy Jul 28 '20 at 08:23
  • This is the only answer that worked. Maybe it worked in combination of other ones. – Sharp Edge Nov 06 '20 at 11:43
  • 6
    My VSCode literally just started doing this without warning. This answer fixed it but not sure what changed in the last 2 minutes! – Mitya Jul 16 '21 at 18:35
32

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:

Noach Magedman
  • 2,313
  • 1
  • 23
  • 18
25

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

Vivek Singh
  • 521
  • 6
  • 9
22

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 .

Jon
  • 404
  • 3
  • 6
20

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?

Kevin_Kinsey
  • 2,285
  • 1
  • 22
  • 23
  • 2
    Thank you! This was driving me insane. – scscsc Apr 14 '20 at 17:16
  • 1
    Digging a bit more, this is called "Preview Editors". The description is "Controls whether editors opened from Quick Open show as preview. Preview editors are reused until they are pinned (e.g. via double click or editing)." Preview editors show with an italic font. Looking in settings, the two options are Workbench > Editor > "Enable Preview From Quick Open" and "Enable Preview". – scscsc Apr 14 '20 at 17:23
18

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.
Alferd Nobel
  • 3,185
  • 2
  • 30
  • 35
11

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

Habib
  • 846
  • 2
  • 9
  • 24
10

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.

Bharat Mallapur
  • 674
  • 9
  • 17
10

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

deva11
  • 881
  • 10
  • 25
10

Follow this,

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

and Restart, Enjoy (y)

Sam
  • 1,106
  • 10
  • 14
9

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.

Henk Kruger
  • 177
  • 1
  • 4
8

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

AEM
  • 1,354
  • 8
  • 20
  • 30
Vishweshwaran
  • 149
  • 3
  • 6
7

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.

olasammy
  • 6,676
  • 4
  • 26
  • 32
6

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.

Ambuj Kumar
  • 71
  • 1
  • 6
5

I think it's the property "workbench.editor.showTabs": true. I had the same problem and I just changed this setting to true.

Zoe
  • 27,060
  • 21
  • 118
  • 148
5

In short: double-click (Open) rather than single-click

Job M
  • 3,331
  • 2
  • 19
  • 26
5

File > Preferences > Settings

Search editor enable preview on search bar, Disable Enable Preview option (Just untick or set false).

enter image description here

enter image description here

XpressGeek
  • 2,889
  • 3
  • 23
  • 27
4

Try this

"workbench.editor.showTabs": true,
"workbench.editor.enablePreview": false,
ricky
  • 125
  • 7
3

In vscode ,click on file>preferance>setting. In setting, there would be a search-bar. There, you have to search "workbench.editor.enablePreview": false. Then you will get one option with checked-box. If it is already checked then you mark it as unchecked.

suresh
  • 31
  • 1
3

I don't like preference options or config files - until recently I preferred the double click file name solution (this one).. but in version 1.71 (August 2022) there's a handy menu option for it on the upper right ... uncheck it and every file will load in a separate tab..

enter image description here

Goodies
  • 1,951
  • 21
  • 26
2

I believe this is a new feature in VS Code, When you are opening a new project and skimming through the code file by file, each file will get replaced in the same tab, Whilst if you do some changes in a file and save it, and try opening a new file it will open in a new file.

May be it is trying to do some kind of tab clean up by restricting the user to open multiple tabs and restricting them to use multiple tabs only when they need to edit the files in them.

2

Goto Settings (Ctrl + ,) Type 'workbench.editor' Click Checkbox on Controls whether opened editors... your problem is solved

workbench editor in vss

Ruli
  • 2,592
  • 12
  • 30
  • 40
2

In VSCode, click Manage (is the gear shown at lower-left corner) > Settings >

in the search bar on top type "showtabs" , do below 2 changes

  1. Workbench › Editor: Show Tabs = checked

  2. Workbench › Editor: Tab Sizing = shrink

vikramvi
  • 3,312
  • 10
  • 45
  • 68
1

On a mac and maybe other OSs you can double click on the filename to pin the file open in the editor. This way, you can selectively choose which files you want to remain open in the VS Code editor.

BrianB
  • 411
  • 1
  • 4
  • 11
0

you need edit setting.json file,

settings.json, located at

Windows %APPDATA%\Code\User\settings.json
macOS $HOME/Library/Application Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json


        {
          "workbench.editor.showTabs": true,
          "workbench.editor.enablePreview": false
        }
hoogw
  • 4,982
  • 1
  • 37
  • 33
0

go to preferences > workbench > enable preview, or just open preferences and search 'preview', mark as true.

0

quick fix, click on the page you want to display in another tab next to it and drag it there and it will revert back to its normal ways of opening each page as a new tab.

my reference is i did it now so i decided to sign up here hoping to make things easier for anyone having this problem.

-1

I had the same problem and I just changed the following settings inside visual studio 2017.

Tools > Environment > Tabs and windows

visual studio 2017 view

Sujay
  • 588
  • 6
  • 15
-1

Go to keyboard shortcuts and search for covert indent to tabs-> by default there won't be any shortcut assigned to it, you have to assign it and then run the shortcut. It will be fixed.