To change your workspace in Visual Studio Code, use the File menu to open a new folder or select a saved .code-workspace file. Changing a workspace allows you to switch between different projects, sets of folders, and specific configuration settings tailored to a particular piece of software or development task. Depending on whether you are using a single-folder workspace or a multi-root workspace, the process varies slightly, but the core action is always centered on the File menu or the Quick Open command palette.

What You'll Need

  • Visual Studio Code installed on your Windows, macOS, or Linux machine.
  • The project folders or the .code-workspace configuration file located on your local drive or network share.
  • Administrative permissions to access the folders you intend to open.

Step-by-Step

  1. Open the File Menu: Click on the File menu in the top-left corner of the application window. Note that menu labels may differ slightly depending on your operating system or the version of the software you are running.
  2. Choose Your Workspace Type:
    • For a Single Folder: Select Open Folder. This is the most common way to change your workspace. A system file dialog will appear; navigate to the directory containing your project and click Select Folder or Open.
    • For a Multi-Root Workspace: Select Open Workspace from File > Open Workspace. This allows you to load a predefined .code-workspace file that groups multiple unrelated folders into one view.
    • To Add to Current Workspace: If you do not want to replace your current view but rather expand it, select File > Add Folder to Workspace. This creates a multi-root environment.
  3. Using the Quick Open Shortcut: For faster switching, press Ctrl+R (Windows/Linux) or Cmd+R (macOS). This opens a list of recently opened folders and workspaces. Use the arrow keys to highlight the desired project and press Enter to switch immediately.
  4. Saving Your New Workspace: If you have added multiple folders and want to return to this exact configuration later, go to File > Save Workspace As. Choose a location on your drive and give the file a name ending in .code-workspace.
  5. Verify the Change: Look at the Explorer view (Ctrl+Shift+E or Cmd+Shift+E). The folder name displayed at the top of the sidebar should now reflect the new workspace you have selected.

Common Mistakes

One of the most frequent errors users make is confusing "Opening a File" with "Opening a Folder." If you use File > Open File, you are only loading a single document into the editor. While you can edit that file, you will not have the full workspace context, meaning your project-specific settings, git integration, and folder structure will not be active. Always use Open Folder or Open Workspace to ensure the full environment is loaded.

Another common mistake is failing to save a multi-root workspace. Users often spend time adding four or five different directories to their view via Add Folder to Workspace, only to close the application and realize they have to manually add every folder again the next time they start. Always use Save Workspace As to create a permanent configuration file.

Some users attempt to change workspaces by simply dragging a folder from their desktop into the editor window. While this often works to open a folder, it can sometimes lead to nested folder structures if a workspace is already active. It is cleaner to use the official menu paths to ensure the previous workspace is properly closed and the new one is initialized.

Tips

To maximize efficiency when changing workspaces, utilize the "Recent" list. Instead of navigating through your hard drive every time, the Ctrl+R / Cmd+R shortcut is the fastest way to jump between active projects. You can also manage this list by going to File > Open Recent and selecting Clear Recently Opened if your list has become cluttered with old, defunct projects.

Consider using Workspace-specific settings. When you change a workspace, VS Code can apply different settings (like tab size, linting rules, or theme colors) that only apply to that specific project. To do this, go to Settings and select the Workspace tab instead of the User tab. These settings are stored in a .vscode folder within your project directory, meaning they stay with the project even if you move it to another machine.

If you frequently switch between a small set of workspaces, you can create desktop shortcuts to your .code-workspace files. Double-clicking a .code-workspace file from your OS file explorer will launch Visual Studio Code and automatically load all associated folders and settings in one step.

Troubleshooting

If the workspace does not change or the folder fails to load, first check if the folder is being used by another process or if it is located on a network drive that has disconnected. A simple restart of the application often resolves issues where the Explorer sidebar fails to refresh after a workspace change.

If you open a workspace and your extensions are not working as expected, verify that the extensions are enabled for that specific workspace. Some extensions allow you to disable them on a per-workspace basis to improve performance. Go to the Extensions view, find the plugin, and check if it says "Disabled (Workspace)"; if so, click Enable.

In cases where the .code-workspace file is corrupted and won't open, the safest fix is to delete the .code-workspace file and manually rebuild the workspace using the Add Folder to Workspace method. Since the actual code resides in the folders and not in the workspace file, you will not lose any of your source code by deleting the configuration file.

If you encounter a "Permission Denied" error when switching workspaces, ensure that your user account has read/write access to the target directory. On macOS and Linux, you may need to check the folder permissions via the terminal or the properties menu to ensure the application can access the files.

Frequently Asked Questions

Can I have multiple workspaces open in different windows?

Yes. You can open a new window by going to File > New Window. In the new window, you can open a completely different workspace, allowing you to view and edit two separate projects side-by-side.

What is the difference between a folder and a workspace?

A folder is a single directory on your disk. A workspace is a VS Code concept that can encompass a single folder or multiple folders (multi-root), along with specific settings and configurations saved in a .code-workspace file.

Will changing my workspace delete my unsaved files?

No. Visual Studio Code typically prompts you to save your changes before switching workspaces. Additionally, the "Hot Exit" feature usually remembers unsaved changes and restores them when you return to that folder.

How do I remove a folder from a multi-root workspace?

Right-click on the folder name in the Explorer sidebar and select Remove Folder from Workspace. This does not delete the folder from your hard drive; it only removes it from the current VS Code view.

Can I share a workspace configuration with a teammate?

Yes. If you save your workspace as a .code-workspace file and commit that file to your version control system (like Git), your teammates can open that file to load the same folder structure and shared settings.