Explanation of This Project
This project can create C/Cpp file in "Opened folder/src" and header file in "Opened folder/include". But I think you might modify the source code to create files of many other types in your desired path.
I create this project because I want to create new cpp file in VSCode, but I set VSCode default language to another more using language. So I want to use File--New File prompt to do this.
However, it seems that VSCode doesn't provide this feature and I search in the extension market, but don't find the desired extension. So I decide to create one by myself.
Installation and Usage
Click "Download Extension" in the right of page to download vsix file. Then in VSCode, Click three dots in the left toolbar--Extensions--Click three dots in the topright of poped up column--Install from VSIX.
First open a folder in Explorer(top at the left toolbar), then click menu button--File--New File to choose file type you want to create, as shown in demo gif.
To Modify Source Code
First, download Node.js:
Make sure that you install npm package manager during Node.js installation.
Then install Typescript:
Last, install vsce:
Git clone or download zip of this project to your computer.
Open terminal from the folder you get, run
Then open scr/extension.ts file. Click three dots in the left toolbar--Run and Debug--Click the green button in poped up column.
It will pop up a new VSCode window, and you can try to use the extension feature as mentioned in Usage section. Note that it will create a scr folder in your user folder, for example, in Windows, C:/Users/<username>/scr.
If you want to add other file type, open scr/extension.ts, find
For example, if you want to add python file in "Opened folder/python", you should copy this block and paste it in the
Then rename the
Then you should modify
Add command in
Now you can use Ctrl+Shift+P and type the title to use the new command, in the Run and Debug window. To let the new command be shown in File--New File, modify
Samely, note the value of
In VSCode menus, there are many groups such as
But I read the source code and it seems that in file/newFile there is just one group: file. And it is at the top in File--New File prompt by default. New created group is under the
So if you have other extensions providing the File--New File feature, they might use the
After modifying, run terminal from the project root folder, and run:
It will create a vsix file. Install it into VSCode and you can use the new extension.