gpt4 book ai didi

visual-studio-code - VSCode扩展中 "array"类型的贡献配置

转载 作者:行者123 更新时间:2023-12-04 03:56:59 25 4
gpt4 key购买 nike

我正在创建VSCode的扩展,该扩展需要使用包含字段a和b的对象数组进行配置。使用扩展名docs()中可用的信息,对于我是否可以定义数组元素的configuration模式,是否将属性类型设置为"array",我还不清楚。我尝试将以下代码放入"configuration"贡献中,但没有成功(我可以在代码中成功检索配置,但是当用户填写数据时没有IDE提示):

"title": "My config",
"properties": {
"array_property": {
"title": "Property",
"type": "array",
"properties": {
"a": {
"type": "string",
"description": "A a"
},
"b": {
"type": "string",
"description": "A b"
}
}
}
}

我尝试用 "type": "array"替换 "type": ["array", "object"],但是它没有任何改变。

最佳答案

使用这样的示例配置

"configuration": {
"type": "object",
"title": "Test configuration",
"properties": {
"mytest.objarrconf": {
"type": "array",
"items": {
"type": "object",
"title": "inner objects",
"properties": {
"name": {
"type": "string",
"description": "Name of inner object"
},
"size": {
"type": "number",
"description": "Size of inner object"
}
}
},
"default": [],
"description": "my test configurations"
}
}
}

这将导致

enter image description here

关于visual-studio-code - VSCode扩展中 "array"类型的贡献配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38678283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com