136

I've got a component-based folder structure in my project. It is a bunch of component-folders with one index.js file each.

Is it possible to make Visual Studio Code display the parent folder name in the file tabs? Or am I limited to seeing a bunch of tabs that all display index.js and nothing else?

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Drkawashima
  • 8,837
  • 5
  • 41
  • 52
  • There is a thread about it here [https://github.com/Microsoft/vscode/issues/8499](https://github.com/Microsoft/vscode/issues/8499) – Anish Oct 31 '16 at 13:52
  • 5
    This setting will show the full path in the title bar (though not the tab): `“window.title”: “${activeEditorLong}${separator}${rootName}”` – edan Mar 30 '18 at 16:34
  • `${activeEditorMedium}${separator}${rootName}` works even better imo, I don't see a reason to see the entire path of the file as opposed to path from src root – Siddhartha Nov 30 '21 at 02:14

8 Answers8

267

You can configure Visual Studio Code to always show parent folder names in the tabs! In your User Settings, just add this line: "workbench.editor.labelFormat": "short" (other values are "long", "medium" or "default")

Result: the files init/views.js, init/routes.js and plugins/modal.js will be presented as such:

Screenshot of Visual Studio Code file tabs


Another option is the User Setting "breadcrumbs.enabled": true which for shows a row of breadcrumbs with the complete file path - in the Code view below the Active tab.

Screenshot of breadcrumbs


PS: To open User Settings use the File-menu → PreferencesSettingsUser Settings. To view the settings in a JSON format just click the {} icon in the top right corner.

Drkawashima
  • 8,837
  • 5
  • 41
  • 52
29

Go to the main menu FilePreferencesSettings. And search for (Cmd + F on Mac; Ctrl + F on Windows and Linux) workbench label format.

Choose the short option.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ValRob
  • 2,584
  • 7
  • 32
  • 40
8

I know this is too late to answer, but in case someone is looking for the file path to show on the title bar, you can follow this:

  1. Open settings (command + ,)
  2. Search for title
  3. You'll see something like activeEditorShort, replace it with activeEditorLong
  4. Save

Source: https://medium.com/riow/vscode-show-full-path-in-title-bar-b0cb731b330

Blues Clues
  • 1,694
  • 3
  • 31
  • 72
7

Visual Studio Code has now improved their tab-UI to resolve this issue.

When you've opened multiple tabs with the same filename, Visual Studio Code will automatically display the parent foldername in each of those tabs.

Here's an example: I've opened two index.js files and one event.js file. VsCode decides it's a good idea to display the foldername for the index.js files but not for the event.js file since that filename is unique

This is enough for me in some situations (when I've got lots of files with the same name)

Drkawashima
  • 8,837
  • 5
  • 41
  • 52
  • 9
    There is also a setting to control the behavior and format of the label: "workbench.editor.labelFormat" – Ej. Oct 23 '17 at 18:54
2

Step 1: Go to File > Preferences > Settings

Step 2: search for "workbench.editor.labelFormat"

Step 3: select medium from a drop-down

cottontail
  • 10,268
  • 18
  • 50
  • 51
Kapilrc
  • 1,362
  • 15
  • 11
2

Video reference codeGrepper

Go to vs code setting and search "Label format" you will see

Workbench › Editor: Label Format Controls the format of the label for an editor.

change from default to short.

Shirshak kandel
  • 328
  • 3
  • 7
0

You can install the nice-index extension for a better experience dealing with index files.

However, as of now, it only works when you have more than one index file open. This can be resolved by changing labelFormat to "short", as other answers suggest.

Vitexikora
  • 308
  • 2
  • 10
  • 1
    The link leads to a `404` error page. – xperator Dec 05 '22 at 10:40
  • Seems like the plugin was discontinued. I stopped using it months ago and rather stopped using index files at all, it was a nightmare to keep an overview of which tab is which file. – Vitexikora Dec 06 '22 at 14:11
-1

In VSCode 1.53 you can use thees settings:

Controls the window title based on the active editor. Variables are substituted based on the context:

${activeEditorShort}: the file name (e.g. myFile.txt).
${activeEditorMedium}: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt).
${activeEditorLong}: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt).
${activeFolderShort}: the name of the folder the file is contained in (e.g. myFileFolder).
${activeFolderMedium}: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder).
${activeFolderLong}: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder).
${folderName}: name of the workspace folder the file is contained in (e.g. myFolder).
${folderPath}: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder).
${rootName}: name of the opened workspace or folder (e.g. myFolder or myWorkspace).
${rootPath}: file path of the opened workspace or folder (e.g. /Users/Development/myWorkspace).
${appName}: e.g. VS Code.
${remoteName}: e.g. SSH
${dirty}: a dirty indicator if the active editor is dirty.
${separator}: a conditional separator (" - ") that only shows when surrounded by variables with values or static text.
  • 2
    While this is useful, it's unrelated to the question, which is about setting the titles of the editor tabs. – Théophile Sep 22 '21 at 16:40