showing project folder in title bar for Visual Studio Code
Visual Studio-CodeVisual Studio-Code Problem Overview
Is it possible to show the last folder in the title bar? If you have multiple instances of VS Code open, it is difficult to distinguish between them from the task bar. If both instances are open on say a file called 'main.ts', you will see 'main.ts' in the taskbar item.
Currently, the title would be [filename open] - [folder open]
(e.g main.ts - angular2-training
. Is it possible to invert them to become [folder open] - [filename open]
(e.g angular2-training - main.ts
?
Visual Studio-Code Solutions
Solution 1 - Visual Studio-Code
window.title
in user/workspace settings
Use The documentation is here with the full list of options of what can be shown. It's quite flexible.
In your case, to display angular2-training - main.ts
you can use this
{
"window.title": "${rootName}${separator}${activeEditorShort}"
}
Older VS Code versions
The above only works in v1.10 and up. Here's how to do it in older versions:
v1.9, v1.8 - "window.showFullPath": true
shows the full path to the current file, so you can at least see the project folder. Note this config is unsupported after v1.10
v1.7 and below - it's not possible
Solution 2 - Visual Studio-Code
On version 1.13
Go to settings, inside UserSettings add this line to the json blob:
> "window.title": "${activeEditorLong}"
On version 1.41.1
Solution 3 - Visual Studio-Code
based uploaded image: > 1,2: Go to Setting > > 3: Search windows title in search box > > 4: Type this statement in windows title box:
${dirty}${separator}${rootName}${separator}${activeEditorShort}
Solution 4 - Visual Studio-Code
If you want to be able to identify which project you are working on by looking at the window title bar, one option is to set "window.title" to a custom value in the workspace settings file at
/.vscode/settings.json
If the file doesn't exist, create it, then add the following to it:
{
"window.title": "<PROJECT NAME> : ${rootName}${separator}${activeEditorShort}"
}
This is a simple solution that works rather well.
Solution 5 - Visual Studio-Code
Tested in 1.44
The setting which matches the OPs problem... not being able to tell which VS Code editor is which from the taskbar... is:
"window.title": "${folderName} ${separator} ${activeEditorShort}"
I prefer the simpler
"window.title": "${folderName}"
${activeFolderShort}
and friends, don't do what I want, as these follow the folder the active file is in. Whereas I want the folder of the whole "project" shown at all times.
Also, when browsing from the taskbar, I don't care what file is active - it is just noise. I care about the project (i.e. folder). On many occasions, every open VS Code will "main.rs" as the active file, so it is pointless to show it!
Editing the settings in json format even includes intellisense now, so you can see all the options without even having to look them up, and they appear as soon you save the settings file. No need to reload. Awesome!
Solution 6 - Visual Studio-Code
v1.31 of vscode added these options to window.title
:
> There are three new variables that can be used within the window.title
> setting:
>
> ${activeFolderShort}
: The name of the folder the file is contained in.
> ${activeFolderMedium}
: The path of the folder the file is contained
> in, relative to the workspace folder.
> ${activeFolderLong}
: The full
> path of the folder the file is contained in.
Solution 7 - Visual Studio-Code
In addition of the setting:
"window.title": "${rootName}${separator}${activeEditorShort}"
You now can configure the separator as well with VSCode 1.45 (April 2020)
> ## Allow customize the window title separator
A new setting window.titleSeparator
allows to change the separator that is used in the window title.
> By default a dash is used.