Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contributing configuration of type "array" in VSCode extension

I'm creating extension to VSCode that needs to be configured with array of objects containing fields: a and b. Using information available in extensions docs () it's unclear to me, if I can define configuration schema of array's elements, if I set property type to "array". I tried to put following code in "configuration" contribution, but no success (I can retrieve successfully configuration in code, but there is no IDE hints when user fills in data):

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

I tried replacing "type": "array" with "type": ["array", "object"], but it did not change anything.

like image 891
Yakuza Avatar asked Jul 30 '16 20:07

Yakuza


People also ask

How do I configure extensions in VS Code?

You can browse and install extensions from within VS Code. Bring up the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of VS Code or the View: Extensions command (Ctrl+Shift+X). This will show you a list of the most popular VS Code extensions on the VS Code Marketplace.


1 Answers

With a sample configuration like this

"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"
        }
    }
}

it will result in this

enter image description here

like image 58
DAXaholic Avatar answered Oct 20 '22 06:10

DAXaholic