Visual studio code 如何在vscode上添加扩展设置架构?
VS代码中的设置支持如下图形面板: 我正在用vscode开发一个扩展,但找不到文档或示例来说明如何添加这些设置。有什么教程可以让我读吗 我尝试了以下配置,但GUI没有显示这些字段的面板:Visual studio code 如何在vscode上添加扩展设置架构?,visual-studio-code,vscode-settings,vscode-extensions,Visual Studio Code,Vscode Settings,Vscode Extensions,VS代码中的设置支持如下图形面板: 我正在用vscode开发一个扩展,但找不到文档或示例来说明如何添加这些设置。有什么教程可以让我读吗 我尝试了以下配置,但GUI没有显示这些字段的面板: "configuration": [ { "type": "object", "title": "MongoDB Runner Configuration", "properties": { "mongoRunner": {
"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"
}
},
这就是你要找的吗?
您可以在描述(属性MarkdownScription)中使用标记,并使用类型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中看起来像
编辑-2:
"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!"
}
}
},
在这种情况下,您的语法格式不正确,请尝试以下操作:
"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"
}
}
},
contributes配置适用于json模式,但没有提供UI。我看到一些扩展配置可以通过GUI进行设置。如何在GUI面板上添加配置?@ZhaoYi配置提供了UI,我在回答中添加了一个示例我也添加了一个示例,但没有显示配置的GUI。配置对json对象有任何限制吗?我刚刚尝试了您的解决方案。它不支持嵌套的json对象。我已经把我的模式放在问题帖上了。