How to manually create a workspace in VSCode

How to manually create a workspace in VSCode

·

1 min read

The usual convention of creating a workspace in VScode is by adding the working folders you desire in the workspace and saving it with any name of your choice.

For example, we have an existing workspace named coding.code-workspace with three working folders: fobabs-app, JavaScript and FOSS as shown below:

Image for post

But what if you want to do it manually, then you’ll have to create a file named example.code-workspace and add the following code into it.

Take note of the “.code-workspace” extension.

{
  "folders": [
    {
      "path": "JavaScript/fobabs/fobabs-app"
    },
    {
      "path": "JavaScript"
    },
    {
      "path": "JavaScript/FOSS"
    }
  ]
}

Looking at the code, you can see they are in JSON format which makes it cool 😎 if you are already familiar with JavaScript Objects. The above code is for folders in the same directory and sub-directories. Let’s say you want to add a folder from a different directory, all you have to do is to do add the file path as shown below depending on your OS installed:

{
  "folders": [
    {
      "path": "JavaScript/fobabs/fobabs-app"
    },
    {
      "path": "JavaScript"
    },
    {
      "path": "JavaScript/FOSS"
    },
    {
      "path": "/home/fobabs/Desktop/facebook-clone"
    }
  ]
}

Now, you’re just a few steps to becoming a VSCode Ninja 🦹‍♀️.