visual-studio-code - 如何将 vscode 贡献的设置设置为颜色类型?
问题描述
我创建了一个简单的 VS Code 扩展,它提供了一组配置设置。这是来自的块的简化示例package.json
:
"configuration": {
"type": "object",
"title": "abc",
"properties": {
"xyz": {
"type": [
"array"
],
"items": {
"title": "Custom patterns to highlight.",
"type": "object",
"properties": {
"foreground": {
"pattern": "^[^$|^\\s]",
"type": "string",
"title": "The color.",
"description": "The foreground color that will be used for highlighting."
}
}
}
}
}
}
有没有办法将设置的类型foreground
设置为颜色而不是任何字符串?似乎没有颜色类型或类似的。
如果设置编辑器能够理解它是一种颜色并像本节中那样显示颜色选择器,那就太好了:
解决方案
您需要添加格式属性:
"myconfig.someColor": {
"type": "string",
"format": "color-hex",
"scope": "resource",
"description": "Some Color"
}
我为此找到了一些文档:
https://github.com/microsoft/vscode/tree/master/extensions/json-language-features/server
推荐阅读
- java - 如何为以下代码设置优先级高精度位置
- ios - SFSpeechRecognizer 是否只识别字母?
- google-analytics - Google 增强型电子商务,set_checkout_option
- angular - 带有分页、排序和过滤器的 Angular 7 表格
- java - AuthenticationMechanism 使用 JSON 而非 HTML 返回 401 的有效负载
- mysql - 将散列密码存储到数据库时出错
- angular - Ionic 3 本地通知和 FCM 无法在 IOS 上协同工作
- algorithm - How many unlucky numbers in segment [a;b]?
- embedded - ARM7 ViSUAL 仿真器和 Keil uVision4
- html - 如何使 CSS 悬停工具提示在表格内显示自动位置(上、右、下、左)