'How can I open a new Visual Studio Code file with pre-set template code inside it?
I would like to know if it is possible to open a new file in Visual Studio Code with code already written inside it, like a template code.
This is to save time instead of writing the same line of code on every new file I create for a project.
Solution 1:[1]
I found that what I was asking for was essentially how to create a code snippet that holds a template code. In Visual Studio Code:
- Use Ctrl+Shift+P (Windows) and search preferences:Configure User Snippits
- Then search javascript.json
- Then write in your code (if you don't know the format use: https://snippet-generator.app/ or search how to write it)
- Then add that code and use your assigned prefix keyword to generate the template on your file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nimantha |
