I created a code snippet like this in the snippets/snippet.json
file:
{
"Add subscription": {
"scope": "typescript",
"prefix": "!subscription",
"body": "subscription: Subscription$0;",
"description": "Add subscription property to a class"
}
}
And I created a package.json
file too:
{
// ...
"contributes": {
"languages": [
{
"id": "typescript",
"aliases": ["typescript", "ts"],
"extensions": [".ts"]
}
],
"snippets": [
{
"language": "typescript",
"path": "./snippets/snippets.json"
}
]
}
}
If I put this snippet JSON into any project's .vscode/mysnippets.code-snippet
file, then it's working fine. But if I publish as an extension and then install it, it's not working.
Any idea?
The main problem is that the extension is installed as a disabled extension.
Using debug mode a message tells the possible cause.
Because there is no
index.js
in this snippet extension, remove the lineTo get a cleaner package also define a file
.vscodeignore
file with contentThere is still a warning left
You have to add them one at a time to see which snippet is causing this warning.