Make your Own VsCode Snippets
Snippets are 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.
2. Make a file index.js
3. use the prefix to type the snippet.
4. 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
Β