VSCode支持IntelliSense,可以方便开发者获得提醒,快速编写代码。JSON常常被用作配置文件。那么如何针对特定的开发环境来定制需要的JSON IntelliSense呢?
JSON Schema
VSCode允许用户配置JSON Schema。JSON schema用于描述和验证JSON数据,本身也是JSON。
这里是一个简单的例子。
{
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}
我给Dynamsoft Barcode Reader的模板文件写了一个简单的JSON schema。
{
"title":