visual-studio-code - Visual Studio Code - 自定义特定 html 标签的颜色
问题描述
在高低搜索之后,我似乎无法找到如何在 Visual Studio Code 中自定义特定 html 标签的颜色。更改它们的颜色很容易,具有以下 textmate 范围:
entity.name.tag.html
这会改变所有标签。但是,如果您只想更改“表单”标签的颜色怎么办?即<form></form>
,例如,如何使“Form”标签与“Div”标签的颜色不同?
检查 VSC 中的编辑器令牌/范围,我可以看到以下范围:
meta.tag.structure.form.start.html
但这会改变其他东西,而不是 Form 标签本身。
解决方案
不知道为什么不适合你?这对我有用:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.tag.structure.form.start.html entity.name.tag, meta.tag.structure.form.end.html entity.name.tag",
"settings": {
"foreground": "#00ff00",
"fontStyle": "bold"
}
},
]
},
请注意,我必须添加entity.name.tag
到每个范围选择器才能使其工作。演示:
你还有其他事情想要完成吗?
推荐阅读
- python - 将 numpy 数组转换为迭代器
- java - Android 在后台使用字符串压缩吗?
- pyspark-sql - 在 Pyspark SQL 中执行多个 SQL 代码
- reactjs - 错误:纱线启动 - 错误命令“start”未找到
- javascript - 如果条件没有给出预期的结果
- haskell - 如何在具有自定义类型类约束的 GADT 上实现 fromJSON?
- dataset - 如何将数据从每 10 行移动到单行?
- postgresql - 当 docker 脚本中的 Python 连接到堆栈中的 SQL 服务器时出现问题
- prestashop - URL 中的 id_product_attribute 问题
- excel - 库存宏 - 将信息从一行工作表复制到另一工作表