我试图让内置颜色选择器以与 vscode 自己的 settings.json 文件相同的方式处理 json (webmanifest) 文件,以在十六进制值旁边显示内联颜色块。
前一个线程建议创建一个模式并format: color在此模式中使用。我已经在 settings.json中的https://code.visualstudio.com/docs/languages/json中的文档中尝试了示例,尽管它确实在我的 webmanifest 文档中提供了代码智能感知,但它仍然没有显示颜色值.
"json.schemas": [
{
"fileMatch": ["*.webmanifest"],
"url": "https://json.schemastore.org/web-manifest",
"properties": {
"theme_color": {
"format": "color"
}
}
}
]
Run Code Online (Sandbox Code Playgroud)
我找不到 vscode 的内置 json 模式来查看它是如何完成的。任何帮助将不胜感激。汤姆
更新
这在包含这type:object对之后起作用。不过还有很多工作要做。
"json.schemas": [
{
"fileMatch": ["*.webmanifest"],
"schema": {
"type": "object",
"properties": {
"theme_color" : {
"type": "string",
"description": "toolbar colour: hex only",
"format": "color-hex"
}
}
}
}
]
Run Code Online (Sandbox Code Playgroud)