Skip to main content
Version: 2.8.0

Custom VS Code Style Snippets

user/init.lua:

return {
luasnip = {
vscode = {
paths = {
"./lua/user/snippets",
},
} ,
},
}

Create a folder inside of your user/ folder called snippets. Add snippets to that folder that follow the vscode style as described in the Documentation

Necessary configuration file in user/snippets/package.json:

{
"name": "user snippets",
"engines": {
"vscode": "^1.11.0"
},
"contributes": {
"snippets": [
{
"language": "vue",
"path": "./vue.json"
}
]
}
}

Example Vue snippet in user/snippets/vue.json:

{
"setup": {
"prefix": ["setup", "template"],
"body": [
"<template>",
"\t$1",
"</template>",
"",
"<script lang=\"ts\" setup>",
"\t$2",
"</script>",
"",
"<style lang=\"sass\">",
"\t$3",
"</style>",
""
],
"description": "My standard setup Vue3 + TS"
}
}