是否可以在 VSC 中编辑内置的 Emmet 缩写?

Mor*_*don 6 emmet visual-studio-code vscode-settings

我希望能够编辑“!”的默认行为 而不是创建我自己的“!”版本 从头开始。

是否可以在 VSC 中编辑(调整)Emmet 缩写的默认行为?

Tim*_*Tim 0

是的!来自文档:

自定义 Emmet 片段需要在名为 的 json 文件中定义snippets.json。该emmet.extensionsPath设置应该具有包含该文件的目录的路径。

{
  "html": {
    "snippets": {
      "ull": "ul>li[id=${1} class=${2}]*2{ Will work with html, pug, haml and slim }",
      "oll": "<ol><li id=${1} class=${2}> Will only work in html </ol>",
      "ran": "{ Wrap plain text in curly braces }"
    }
  },
  "css": {
    "snippets": {
      "cb": "color: black",
      "bsd": "border: 1px solid ${1:red}",
      "ls": "list-style: ${1}"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

更多信息请点击这里。

您还可以使用过滤器修改现有块。

  • 您能否展示一个工作示例,例如如何在内置“!”上使用过滤器? (2认同)