Make your Own VsCode Snippets
Abhay Prajapati
Posted on April 12, 2022
Make your Own VsCode Snippets
Snippets are aer very useful for quickly creating code, but do you know it's more AWESOME to make one ?
Make your own snippets in VsCode
1. Open VsCode and type
Press Ctrl + Shift + P to Open Command Palette in VsCode.
1. type Configure User Snippets
π₯ Enter
1. type Select the language you want to create snippets for
- java
- javascript
- python
- css .... Let's Enter Javascript.
{
// β this is name of snippet
"Print to console": {
// β this is prefix the command will be typed to use it.
"prefix": "log",
// β this is the snippet itself, body of the snippet
"body": [
// $1 is the placeholder for the first argument, $number defines tabindex for the snippet.
"console.log('$1');",
"$2"
],
// β this is the description of the snippet.
"description": "Log output to console"
}
}
1. type Save the snippet/ Close the file.
- Make a file index.js
- use the prefix to type the snippet.
- type log and hit enter.
you can also add more functionality like filename, foldername, cursor position, to your snippets, as a adding variables to your snippets
Read more variables in snippets from VsCode snippets docs.
Share which snippets you are gonna create with this
Thanks for reading.
Share your snippets with everyone.
comment about topics you like.
π€πΎConnect me on:
Twitter: ποΈ@Abhayprajapati_
Github: π§@theabhayprajapati
Linkedin: π@abhayprajaapati
Youtube: πΊ@Abhayprajapati
π πͺ π
π©
Abhay Prajapati
Posted on April 12, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.