ionic-frameworkvscode-extensionsvuejs3vscode-snippetsionic-vue

How to add VS Code snippet inside a template


I am trying to create ionic vue snippets. So far it seems to only work when added on the top level and not working when added inside a template or div tag. How can I insert snippets inside these tags?

Snippet

  "ionic-vue Item": {
    "prefix": "ivitem",
    "body": [
      "<ion-item>",
        "<ion-label>",
          "${1:Item}",
        "</ion-label>",
      "</ion-item>"
    ],
    "description": "Creates ionc-vue item"
  },

enter image description here


Solution

  • Set the snippet scope to html,vue-html:

    {
      "ionic-vue Item": {
        "scope": "html,vue-html",
        //...
      }
    }