【问题标题】:VSCode Snippets not working inside Vue's template/script/style tagsVSCode 片段在 Vue 的模板/脚本/样式标签中不起作用
【发布时间】:2023-02-10 18:35:24
【问题描述】:

我是 vscode 的新手,无法让 sn-ps 在 Vue 文件中正常工作。他们在工作/snippets/vue.json:

{
  "<template></template>": {
    "prefix": "template",
    "body": [
      "<template>$1</template>"
    ]
  }
}

这有效,只要它写在vue base layer 但不在script/template/style 标签内。我试过将它添加到 vue-injection-markdown.json,我认为它正是用于此目的,但它不起作用。我还创建了一个 vue-html.json 文件并在其中添加了 json,但它也没有使 sn-ps 工作:

{
  "hello": {
    "prefix": "hello",
    "body": [
      "blub"
    ]
  } 
}

我已经安装了这两个插件:

  • Vue 语言特性(Volar)
  • TypeScript Vue 插件(Volar)

我究竟做错了什么?

【问题讨论】:

  • 尝试为 strings 打开 Editor: Quick Suggestions on
  • @Mark 我做了,但没有帮助。

标签: vue.js visual-studio-code vscode-snippets


【解决方案1】:

好的,它必须在 global.code-snippetshtml 范围内或在 html.json 文件中定义。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-22
    • 1970-01-01
    • 1970-01-01
    • 2018-03-31
    • 2020-12-03
    相关资源
    最近更新 更多