Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To add an array configuration to a VSCode extension, follow these steps:

  1. Create a new file in your extension's root directory named package.json.

  2. In package.json, add a new section called configuration that lists all of the configuration options in an array format.

"configuration": {
    "arrayConfig": {
        "type": "array",
        "description": "An example array configuration",
        "default": ["Option 1", "Option 2", "Option 3"]
    }
}
  1. In your extension's code, access the configuration using the workspace object and the getConfiguration method.
const config = vscode.workspace.getConfiguration();
const arrayConfig = config.get('extensionName.arrayConfig');
  1. Use the arrayConfig variable in your extension to retrieve the selected options from the user.

Note: Make sure to update extensionName with the name of your extension.