Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code - Why Use Workspaces over Standard Folders?

I've been searching and searching for what the purpose is for a workspace. I've asked this question in stack chats but no one seems to know.

I know workspaces are local copies of solutions and you can switch between them when testing different things on the same projects but with different branches but I can do that with standard folders as well. So I can't figure out what the advantages and disadvantages are of using workspaces over normal folders. Is having different settings for each workspace the only advantage?

The only other obvious thing I see is shown in the screenshot but that a workspace is shown as a single "Code Workspace" file with no folder structure even though it does have one while standard folders have the structure and shows all contents. Standard folder structure & Workspace Structure

I found this article on stack and it's kinda relevant but not as specific and it's unanswered. So instead of setting a bounty I thought I'd ask exactly what I was looking for. Asking about workspaces with settings vs user settings.

like image 365
Daniel Jackson Avatar asked Mar 14 '18 17:03

Daniel Jackson


People also ask

What is the difference between folder and workspace VS Code?

You don't have to do anything for a folder to become a VS Code workspace other than open the folder with VS Code. Once a folder has been opened, VS Code will automatically keep track of things such as your open files and editor layout so the editor will be as you left it when you reopen that folder.

What is the difference between a workspace and a folder?

A workspace can contain multiple folders. You can customize the settings and preferences of a workspace. A workspace is a folder, or multiple folders, mapped to areas in TFS.

How does workspace work in VS Code?

A workspace is a virtual collection of folders opened simultaneously in Visual Studio Code and defined in a . code-workspace file. Opening this file will open the collection of folders automatically. This is called a "multi-root" workspace.

Can you have multiple workspaces in VS Code?

You can work with multiple project folders in Visual Studio Code with multi-root workspaces. This can be helpful when you are working on several related projects at one time.


2 Answers

Two things which makes Workspace different from standard folders -

  1. Like the other answer you linked to, you can have workspace based settings
  2. In one Workspace you can open different folders which are not necessarily in the root folder which you open first.
like image 92
abhijit Avatar answered Sep 28 '22 10:09

abhijit


In addition to workspace-based settings, workspaces can act like aliases that can link to a root folder (sort of like Dreamweaver's Sites feature). So you can keep a centralized folder/collection of all your workspaces in one place for easy navigation (a folder named VSC-Workspaces for example), yet they can point to and open work folders that may be saved in different locations on your hard drive, since they might be websites or python files, etc.

like image 43
rmhoma Avatar answered Sep 28 '22 09:09

rmhoma