skeleton for a VSCode extension that provides snippets
Instead of typing up the snippets JSON file manually (because it sucks),
you define each snippet in a file in src/snippets/<language>/<key>.ts
.
The build scripts will then compile these files into the JSON that VSCode
understands and add the contributes.snippets
entry to package.json
.
For example:
// optional, defaults to filename without extension
export const prefix = 'example'
export const description = 'An example snippet'
// The build tools will strip off the leading and trailing newlines so that you
// don't have to indent anything.
export const body = `
export default function $1() {
$0
}
`
Output:
{
"example": {
"prefix": "example",
"description": "An example snippet",
"body": [
"export default function $1() {",
" $0",
"}"
]
}
}
export default function $1() {
$0
}