Search code examples
vue.jsvisual-studio-codeautocompletevscode-snippetsvetur

User snippets is not working with Vetur pacakge in VScode


Hi guys I'm using VScode and using [![Vetur][1]][1] for Vuejs syntax highlighting and auto complete support.I am trying to get some user snippets to work with Vetur so, I've tried adding them to the vue.json file but with no success.

I also have some custom/user Vue snippets which works fine with .HTML, .JS files but when comes to .vue file it was not working?

Please can anybody help me?


Solution

  • Vetur is pretty fine-tuned with the snippet settings.

    <template>
      <!-- Use `vue-html` snippets here -->
    </template>
    
    <!-- Use `vue` snippets here -->
    <style>
    </style>
    

    Or when using TypeScript

    <script lang="ts">
      // Use TS snippets here
    </script>
    

    Source: https://vuejs.github.io/vetur/snippet.html

    That means if you want to add snippets to your template you need to add them to the vue-html.json. Your Vue snippets will most likely already work but they're only accessible in between <template> and <script>