54

My vscode project has an "app" folder which is the root folder for my workspace.

It is possible to change the title of this workspace?

workspaces

kolypto
  • 31,774
  • 17
  • 105
  • 99

5 Answers5

56

Use the "File -> Save Workspace As ..." to save it into a file.

Menu

Normally, you would only want to use a <name>.code-workspace file with multi-root projects (that is, projects that include multiple folders), but this is also the only way to rename a workspace.

More information:

P.S. All the credit goes to Henry for pointing me to .code-workspace files :) Thanks!

kolypto
  • 31,774
  • 17
  • 105
  • 99
  • 3
    This doesn't really rename the workspace, it just duplicates the workspace file under a new name. So, you still have the old workspace file that you'll then have to delete manually. – Gabriel Staples Oct 14 '21 at 19:29
19

Simply edit the .code-workspace file contained in the actual folder (via file explorer) and rename it. That's it!

Henry
  • 191
  • 6
  • 1
    You should probably go to **File --> Close Workspace** first, and _then_ use your file explorer to rename the workspace file, and then re-open the workspace. – Gabriel Staples Oct 14 '21 at 19:28
  • @GabrielStaples If you save the .code-workspace file, the Visual Studio Code UI updates pretty much immediately, even if it's open. I think it's designed such that there's no need to close the workspace first. – Grant Apr 17 '22 at 01:24
16

I haven't yet found a way to change the name of the workspace itself (without changing the filename); but one thing not mentioned in other answers that might be relevant: you can edit the .code-workspace file and add a name property to set a custom display name for each folder in your workspace:

{   
  "folders": [
    {
      "path": "../path/to/folder",
      "name": "my custom folder name"
    }
  ],
  "settings": {}
}
blindfish
  • 783
  • 8
  • 10
9

Another setting I always use, is to change the text in the title bar "window.title" (aside from changing colors per workspace). This helps me distinguish different workspace easily.

.code-workspace file (Ctrl+Shift+P (Or F1) option Preferences: Open Workspace Settings (JSON)

{
"folders": [
    {
        "path": "./path/to/workspace",
        "name": "My custom name"
    }
],
"settings": {
    "window.title": "My custom title",
    "workbench.colorCustomizations": {
        "titleBar.activeBackground": "#DBEAFE",
        "titleBar.activeForeground": "#000000",
        "activityBar.activeBackground": "#DBEAFE",
        "activityBar.activeBorder": "#000099",
        "activityBar.background": "#DBEAFE",
        "activityBar.foreground": "#000099",
        "activityBar.inactiveForeground": "#686575",
        "activityBarBadge.background": "#000099",
        "activityBarBadge.foreground": "#FFFFFF",
        "statusBar.debuggingBackground": "#FEAC32"
    }
}
CoonHouse
  • 93
  • 2
  • 5
  • Is this `workspace.json` ? How do you access this file? I was able to access it via Ctrl+Shift+P > `Preferences: Open Workspace Settings (JSON)`. This worked well for a multi-root workspace. – qyb2zm302 Dec 08 '22 at 23:22
  • 2
    @qyb2zm302 Yes, indeed, via `Ctrl+Shift+P` (Or `F1`) option `Preferences: Open Workspace Settings (JSON)`. Another way is to open the `.code-workspace` file from the filesystem using a text editor. – CoonHouse Dec 10 '22 at 10:22
  • This works only if you open the workspace as a folder. When opened as a _workspace_ `window.title` is ignored (greyed out; hovering it will explain why). – Kamafeather Jun 23 '23 at 21:37
  • @Kamafeather : Not sure what you mean, the `code.workspace` file only exists if it is a workspace. I always open workspaces. – CoonHouse Jun 30 '23 at 15:01
  • If I'm not wrong, VSCode can open folders "as folder" even when there's a `workspace` file. It will prompt to re-open "as workspace" using that file, but it's not automatic. Some settings are considered only when opened "as folder" while others considered only when opened "as workspace". – But, as I said, I might be wrong. – Kamafeather Jun 30 '23 at 21:22
4

How to rename a VSCode workspace:

  1. File --> Close Workspace.

    enter image description here

  2. Manually rename the workspace file in your operating system's file explorer or terminal. Ex: on Linux or Mac or in the git bash terminal using Git For Windows:

    cd path/to/workspace
    mv old_workspace_name.code-workspace new_workspace_name.code-workspace
    
  3. File --> Open Workspace from File..., then select the workspace you just renamed.

    enter image description here

See Also:

  1. The other answers here.
  2. Official VSCode documentation: https://code.visualstudio.com/docs/editor/multi-root-workspaces#_save-workspace-as
Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265