- Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements.
Cogwheel -> User Snippets
Windows: Ctrl + Shift + P
Mac: Ctrl/Cmd + Shift + P
You can define snippets for each language like JavaScript, CSS, Go and more
The shortcut name you want to set to trigger the snippet.
Note: You can use multiple names here
Syntax: $1, $2
Make the editor cursor move inside a snippet.
Each tab key press will move the cursor to the next position
Syntax: ${1:default}
Same as tabstops but with a default value
Syntax: ${1:another ${2:placeholder}}
These can all be nested together
Syntax: ${1|one,two,three|}
Placeholders can have choices in a dropdown list as values.
Syntax: ${WORKSPACE_NAME:default}
You can insert some predefined variable names
It is possible to transform values using regex
Example: Uppercase all characters
Set a description for the custom snippet