VS Code extension for creating new folder in workspace

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!

Cloud Solution Architect | Author | Full Stack Developer | https://www.linkedin.com/in/balram-chavan | https://www.hiretheauthor.com/balramchavan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store