Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method for supplying schema for command arguments in a vscode extension is by using the args property in the package.json file of the extension.

You can define each argument's name, type, description, required status, default value, and other properties in the args property.

Here's an example:

{
   "contributes": {
      "commands": [
         {
            "command": "myExtension.myCommand",
            "title": "My Command",
            "category": "My Category",
            "description": "Description of my command",
            "args": [
               {
                  "name": "arg1",
                  "type": "string",
                  "description": "Description of arg1",
                  "required": true
               },
               {
                  "name": "arg2",
                  "type": "number",
                  "description": "Description of arg2",
                  "default": 0
               }
            ]
         }
      ]
   }
}

In this example, the myExtension.myCommand command has two arguments: arg1 and arg2. arg1 is a required string argument with a description, while arg2 is an optional number argument with a default value of 0 and a description.