This extension helps in creating files easily from defined templates.
Original Source
This extension is an altered version of the vscode-file-templates from Venkatesh Boddu (Extension id: bam.vscode-file-templates)
Features
Create new files from pre-defined templates.
Create new File Templates either from a file or a blank template.
Edit Templates.
Add Author Name, File Name and Date of creation to the file.
For Students there is also the possibility to add a Student Number to the file.
Change the default Template directory.
Choose commands from Command Palette:
Create a new File from Template:
Usage
Right-click on the VSCode Explorer where you want to create a new file, you will see an option 'Create New File from template'.
Selecting this option shows a menu with existing templates. Select the desired template and enter the new file name. New file
will be created in the selected folder.
You can also create a new File from template by Right-click on the editor. On Right-click in the editor, you will all also see
'Create Template from file' option. Select this option to create a new Template from the current active document.
You can also do all these the other way by selecting the appropriate command from Command Palette. From Command Palette, select
'Files: New File from template' - to create a new file from template
'Files: New File Template' - to create a new blank file template.
'Files: New Template from File' - to create a new template from the current active file.
'Files: Edit File Template' - to edit any existing template.
'Files: Remove a File Template' - to remove a file template.
Template Variables
Configurable:
* {{AUTHOR}} Add the author name to the file.
Dynamic:
* {{DATE}} Add the current date to the file.
* {{FILE}} Add the filename ( including extension ) to the file.
* {{FILENAME}} Add the filename ( excluding extension ) to the file.
Static:
* {{PRODUCT_NAME}} Add the name of the IDE (Visual Studio Code) to the file.
Templates Location
Depending on your OS, default templates are located at
* Windows : %USERPROFILE%\.vscode\extensions\2MuchLag4U.vscode-template-manager-{version}\templates
* Mac : ~/.vscode/extensions/2MuchLag4U.vscode-template-manager-{version}/templates
* Linux : ~/.vscode/extensions/2MuchLag4U.vscode-template-manager-{version}/templates
You can also create workspace specific templates.
* Worspace templates are located at /%WORKSPACE_ROOT_FOLDER%/.vscode/templates
You are also able to change the extensions folder through the extension settings.
Template Location
For Windows and MAC:
Available environment variables:
%USERNAME% username of the current user.
%USERPROFILE% User profile folder
For windows only:
Available environment variables:
%ONEDRIVE% Onedrive location ( When business onedrive connected this will be the location of the business onedrive ).
%ONEDRIVECONSUMER% Onedrive location ( Personal onedrive location ).
%COMPUTERNAME% Current computer name
%HOMEPATH% User homepath location.
Extension Settings
This extension contributes the following settings:
template-manager-vscode.Author: Set the Author name.
template-manager-vscode.TemplateDirectory: Set the default template directory. ( Only available for Windows )
template-manager-vscode.DefinedVariables: Set custom static variables
KeyBindings
Create a New File from template
Windows: 'ctrl + alt + n'
MAC: 'cmd + alt + n'
Release Notes
1.0.0
Initial release of the extension for VSCode
1.0.1
Initial directory fix
1.1.0
Fix the lowercase template file names.
Add ${FILENAME} as template variable. ( Filename without extension )
Add the command option Files: Remove a File Template
1.1.4
Update the readme and changelog file.
Update template folder path.
Fix Launch issue
1.1.5
Restructure code
Remove the Student Number configuration option
Add the DefinedVariables configuration option
Change the create new file from template shortcut to ctrl + alt + n
Add support for empty file name to create untitled files from the templates.
Change prompt messages to a configuration file ./src/config.js
Change template variables from {VARIABLENAME} to {{VARIABLENAME}}