vinodon Stack Overflow • Recommends
On “How to add custom code snippets in VSCode?”
You can check out this video for a quick short tutorial
link to this video
Go to File --> Preferences --> User Snippets . Select your preferred language.
Now type the following code to make a for loop snippet:
"Create for loop":{
"prefix": "for",
"body":[
"for(int i = 0; i < 10; i++)",
"{",
" //code goes here",
"}"
],
"description": "Creates a for loop"
}
You are done.
Type "for" in the editor and use the first prediction.
SHORTCUT
install snippet-creator extension (now deprecated).
Highlight the code that you need to make snippet.
press ctrl + shift + P and type "Create snippet" on the command palette and
press ENTER.
select language for which you want to create snippet(eg:-CP…