Save custom snippets in Visual Studio Code
Visual Studio Code is one of the best programs currently, since it is free, open source, extensions, cross-platform, has Git and integrated terminal 🙂
On the other hand, as we see in this article, note that you can create your own custom code snippets and call them with a keyboard shortcut (prefix) + tab.
Create custom snippets in VSCODE
Open vscode custom snippet settings
- You open the VSCODE command line:
ctrl + shift + P
- After the symbol
Preferences: Configure Users Snippetsand that corresponds to the snippet configuration.
First is the name, and within this 3 elements:
- Prefix: the prefix or keyboard shortcut with which to call the snippet
- Body: properly the code to save
- Description: a helpful description for when you have many
In my case I have 2 snippets that show the
Important: so that you can directly write the prefix and with the tab the prepared code is already inserted, check that you have the option: "editor.tabCompletion" active in the vscode options.
Create snippets faster
With this extension you simply write in your file the code that you want to convert into code that is always accessible with a shortcut, and then on the command line you search for "Create snippet" after which it will ask you for the data to create it: language, name, prefix and description and only with this you have it inside the configuration json file.