2022-09-27

Opening Files in New Tabs in VSCode

Introduction

One of VSCode's default behaviors is to overwrite the current tab each time a file is opened from the tree view. While this can help keep your workspace uncluttered, it may not be the most efficient way of working for some users.

This article introduces how to open files in a new tab each time, instead of overwriting the current tab. This can be particularly useful if you need to switch back and forth between multiple files frequently, or if you simply prefer having each file in a separate tab for clarity.

Modifying VSCode Settings

To begin modifying your VSCode settings, start by locating the gear icon in the lower left-hand corner of your VSCode window. This icon represents the main menu for accessing and altering various aspects of the VSCode interface and functionality.

Click on the gear icon, a drop-down menu will appear. From this menu, select 'Settings'. Upon selection, the Settings tab will open. This tab is the hub for all configurable parameters in VSCode. It contains different categories and sub-categories of settings, allowing you to modify everything from visual themes and key bindings to specific language settings.

VSCode new tab | 1

Within the Settings tab, navigate to the 'Workbench' settings. Under 'Workbench', look for the sub-category titled 'Editor Management'. This category controls various aspects related to how files are displayed and interacted within VSCode.

In the 'Editor Management' category, locate the 'Enable Preview' option. This option is responsible for the default behavior of opening files in the same tab. By default, this setting is switched on. To ensure files open in a new tab each time, you need to turn this setting off. Click on the switch to change its status.

VSCode new tab | 2

Remember, these changes will take effect immediately after you alter the setting. You do not need to restart VSCode for the new setting to apply.

Checking the Changes

With your changes saved and the Settings tab closed, you can now verify the new behavior. Navigate to the file explorer on the left side of your VSCode interface and open a file by clicking on it. It should now open in a new tab instead of overwriting the current tab. If you want to open another file, it should also open in a new tab.

Ryusei Kakujo

researchgatelinkedingithub

Focusing on data science for mobility

Bench Press 100kg!