VS Code 中的设置支持如下图形面板:
我正在 vscode 中开发一个扩展,但我找不到文档或示例来展示如何添加这些设置。有没有我可以阅读的教程?
我尝试了以下配置,但 GUI 没有显示这些字段的面板:
"configuration": [
{
"type": "object",
"title": "MongoDB Runner Configuration",
"properties": {
"mongoRunner": {
"type": "object",
"default": {},
"description": "Complete connection configuration for your MongoDB.",
"properties": {
"connection": {
"title": "MongoDB Runner Configuration",
"type": "object",
"properties": {
"url": {
"type": "string",
"default": "mongodb://",
"description": "MongoDB URI"
},
"activeOnStartUp": {
"type": "boolean",
"default": false,
"description": "whether launch mongodb runner on start up"
}
}
}
}
}
}
}
]
下面是我需要支持的json文件格式:
"mongoRunner": {
"connection": {
"activeOnStartUp": true,
"url": "mongodb://localhost:27017"
}
},
最佳答案
是 this你在找什么?
可以在描述中使用markdown(属性markdownDescription),使用boolean类型出现复选框。
示例:
"configuration": {
"type": "object",
"title": "Test configuration",
"properties": {
"test.usingUI": {
"type": "boolean",
"default": false,
"markdownDescription": "**Some bold text**\nYes or no?"
},
"test.text": {
"type": ["string", "null"],
"default": null,
"description": "You can't edit me now!"
}
}
},
在 UI 中看起来像
this
编辑 - 2:
在这种情况下,您的语法格式错误,请尝试以下操作:
"configuration": {
"type": "object",
"title": "MongoDB Runner Configuration",
"properties": {
"mongoRunner.url": {
"type": "string",
"default": "mongodb://",
"description": "MongoDB URI"
},
"mongoRunner.activeOnStartUp": {
"type": "boolean",
"default": false,
"description": "whether launch mongodb runner on start up"
}
}
},
-> UI
关于visual-studio-code - 如何在 vscode 上添加扩展设置架构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52349980/