English | 日本語
Snippet Inserter is an extension for Visual Studio Code. This extension allows you to insert only specific snippets from files in a given folder.
- Insert specific snippets from files
- Extracts and inserts the portion from the point containing "@snippet_start" to "@snippet_end
- Use in conjunction with line comments according to your programming language
- You can set up a folder to search for snippets to make your search more efficient
- open the Extensions tab of Visual Studio Code
- Type "Snippet Inserter" in the search bar to find the extension
- Click the "Install" button to install the extension
- After installation, restart Visual Studio Code
How to use
- Add a snippet to the file. A snippet starts with a line containing "@snippet_start" and ends with a line containing "@snippet_end".
// Assume an example where the line comment is "//".
// this part is inserted as a snippet
Open the Command Palette and execute the "Set Snippet Folder" command and set folder path.
Open the Command Palette and execute the "Update Target File Extensions" command and set extensions you need.
Position the cursor in the open file where you want to insert the snippet.
Open the Command Palette and execute the "Insert Snippet" command.
A list of files in the specified folder will be displayed, so select the file into which you want to insert a snippet.
The snippet of the selected file will be inserted at the cursor position of the currently opened file.