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:
Your First Extension
In this topic, we'll teach you the fundamental concepts for building extensions. Make sure you have Node.js and Git…
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:
- 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 Folderin search bar and press Enter to execute.
- It will create new folder with name
New Folder. And that’s our working extension output!!!
VS Code extension for creating new folder in Workspace - ultrasonicsoft/create-new-folder-vs-code-ext