About the structure of json file
json
{
"meta": [],
"root": [],
"options": [],
"common_options": [],
"config": [],
"info": {}
}- The json file uses a schema structure to ensure that the json content is correct and complete.
- You can learn about these properties by hovering over the prompts in vscode.
- In fact, it is very simple, you can refer to the existing json file.
Properties
1. meta
- The type of value: object
- Define the related information of the completion command.
- It needs two attributes:
url:The address of the completion command.description:A simple description of the completion command.
2. root
- The type of value: array
- Each item in the array is an object.
- Object available attribute:
name(required)、alias、next、options、tip、hide
3. options
- The type of value: array
- Same as the
optionsfor each item inroot.
json
{
"name": "-V",
"alias": [
"--version"
],
"tip": [
"U: -V, --version\n",
"Show the version."
]
}4. common_options
- The type of value: array
- Same structure as
options - All options are displayed at all times.
json
{
"name": "-h",
"alias": [
"--help"
],
"tip": [
"U: -h, --help\n",
"Show the help."
]
}5. config
- The type of value: array
- Define some special configurations for completion.
- e.g.
gitjson"config": [ { "name": "max_commit", "value": 20, "values": [ -1, 20 ], "tip": [ "The maximum number that can be parsed for a project commit. Default to 20.\n", "If it is <@Magenta>-1<@Blue>, all commits will be parsed, which may affect the loading speed." ] } ]
6. info
- The type of value: object
- All the defined values can be used in other
tipusing the following syntaxjson{ "root": [ { "name": "test", "tip": "{{ $info.test_tip }}" } ], "info": { "test_tip": "这是一个测试内容" } }