VS Code extension for creating new folder in workspace

Balram Chavan
2 min readJul 7, 2019

VS Code extension gives developer an opportunity for extending capability of VS Code. In this story, we will see how to create new folder in VS Code Workspace using VS Code API.

Create a new extension project:

If you are new to creating VS Code extension, then follow below tutorial:

Create New workspace folder:

VS Code API has updateWorkspaceFolders function to update workspace. Checkout the official documentation for parameter details.

Using this function, we can add/remove/edit existing workspace folders. Since our goal is to add a new folder, we will call this function with below arguments:

Running extension

  • In VS Code, press F5 to launch a new instance of VS Code with our new extension.
  • Launch Command Palette from “View/Command Palette” menu ( or press ⇧⌘P in Mac OS), type Create New Folder in search bar and press Enter to execute.
  • It will create new folder with name New Folder. And that’s our working extension output!!!

Source Code

Cheers!

--

--