html - 如何在 VSCode 中添加自定义 emmet 片段?
问题描述
根据2020 年 10 月的变更日志,可以为 VSCode 添加自定义代码段。假设我已经snippets.json
找到了workspace\configs\emmet
这样的内容:
{
"html": {
"snippets": {
"btn:b|button:button|button:b": "button[type={button}] ${1}"
}
}
}
我想以.code-workpace
文件操作系统无关的方式链接它的路径,所以使用一堆VSCode 变量:
{
"settings": {
"emmet.extensionsPath": "${workspaceFolder}${pathSeparator}configs${pathSeparator}emmet"
}
}
但是这个新片段没有出现在建议中。是什么赋予了?
解决方案
在 VS 代码菜单中,点击 File -> Preferences -> User Snippets,
然后像这样添加代码段:
"<snippets name>": {
"scope": "< e.g javascript,typescript,vue,coffeescript,typescriptreact>",
"prefix": "<your prefix>",
"body": [
"<snippet body"
]
},
推荐阅读
- javascript - 从两个不同的数组中返回具有最接近数字的数组
- python - 在 Python 中编辑字典列表中的值
- material-ui - 移除 Material UI 的默认值
- javascript - 如何使用 JavaScript 在 Elementor Pro 中动态初始化 Swiper.JS?
- c# - 如何在 Entity Framework Core 中生成空迁移?
- node.js - 对服务器端firebase函数的函数调用进行身份验证
- amazon-web-services - aws ec2 的 python lambda 代码被停止
- javascript - 使用 node.js 进行 GCP Firestore 分页 - 没有快照的查询游标
- regex - (b*a)* 和 (ab*)* 有什么区别?或者他们是同一种语言?
- html - 滚动时不会自动调整内容高度