How do I configure VS Code to enable code completion on .json files (jsonschema support)?

前端 未结 3 1943
梦毁少年i
梦毁少年i 2021-02-12 15:20

In the Visual Stuido Code demo minute 28:57-29:20 and 30:20-31:10, some cool JSON code completion is shown.

Where and how do I add a schema for my JSON files to a projec

3条回答
  •  独厮守ぢ
    2021-02-12 15:57

    The association of JSON schemas to files is done in the settings (File, Preferences, User Settings or Workspace Settings), under the property 'json.schemas'.

    This is an example how the JSON schema for bower is associated to the bower schema.

    "json.schemas": [
        {
            "fileMatch": [
                "/bower.json",
                "/.bower.json"
            ],
            "url": "http://json.schemastore.org/bower"
        },
        ...
    

    You can also use schemas located in your workspace or define a schema right in the settings itself. Check https://code.visualstudio.com/docs/languages/json for examples.

提交回复
热议问题