2106

I am using Visual Studio Code 1.3.1 with the newly introduced tabs.

When I click on files, the first file will open in a tab. If I do not make any changes to this file, the second clicked file will open in the same tab.

How can I avoid this and make Visual Studio Code always open a new tab?

6
  • 12
    See stackoverflow.com/questions/45945820/… Alt-Enter added this functionality as of v1.19 in December 2017. Commented Dec 15, 2017 at 22:33
  • 47
    if you double click and open the file form left panel, it will not be replaced by other tabs Commented Aug 21, 2018 at 14:50
  • for those who want to open new file in the previous session (in a new tab, when VScode is off): "window.restoreWindows": "preserve", github.com/microsoft/vscode/issues/36964 Commented Feb 15, 2022 at 9:29
  • 1
    Haven't seen it mentioned, but you can also middle-click in the Explorer sidebar and that will open it in normal, non-preview mode Commented Oct 29, 2023 at 19:33
  • Why are there so many duplicate answers to this question? Probably need a clean-up? Commented Apr 29, 2024 at 10:46

36 Answers 36

1
2
1

Use SettingsWorkbenchEditor ManagementEnable Preview.

Sign up to request clarification or add additional context in comments.

1 Comment

How do you get to "Settings"?
1

In my case, I had accidentally changed the setting for viewing files in tabs and didn't know where to look to change back to the behavior I was used to, i.e., double-clicking on the files name in the file explorer pane (typically on the left-hand side) to open the file in a new tab.

There is a setting to check or uncheck "enable tabs".

In Visual Studio Code 1.77.3, you can click on the three dots on the right-hand side (see the image below).

Enter image description here

Note:

Full version information of my Visual Studio Code installation:

  • Version: 1.77.3
  • Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
  • Date: 2023-04-12T09:16:52.732Z
  • Electron: 19.1.11
  • Chromium: 102.0.5005.196
  • Node.js: 16.14.2
  • V8: 10.2.154.26-electron.0
  • OS: Linux x64 6.2.0-20-generic snap
  • Sandboxed: Yes

Comments

1

In my case, I have to additionally disable the EditorLimit option to work correctly with the above settings mentioned in the comments. Otherwise, it will keep reusing the same tabs.

Enter image description here

Comments

1

Inside the settings.json file:

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

Comments

0

If you have opened a file in preview mode and want to open a new file in another tab:

For Mac: use Cmd + P → find the file and Alt + Enter.

2 Comments

Hi, The question here is about opening a file from explorer menu, not by searching out the file via cmd+P option. Moreover, anyhow, the cmd+P option opens a file in a new tab itself. But your method definitely works!
Re "Cmd + P": It is Ctrl + P for the rest of us
0

Menu FilePreferences does not exist in Visual Studio 2022.

For Visual Studio 2022 specifically, this does work: open the menu ToolsOptionsExpand Environment → select Tabs and Windows

Then, simply uncheck "Allow new files to be opened in the preview tab"

Checked was my default. Changing it to unchecked got rid of the preview tabs in Visual Studio 2022.

1 Comment

The question is about Visual Studio Code, not Visual Studio. Blame Microsoft marketing for the nearly identical names.
1
2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.