Reputation: 2055
Should VSCode have automatic intellisense in JSON files? If so, how does it work? I know it works for well-known JSON files, like tsconfig.json, but what about other resources like stryker.conf.json?
In a number of resources online I read that it should automagically work for any schema in https://schemastore.org/json, for example: https://joshuaavalon.io/intellisense-json-yaml-vs-code. However, it doesn't seem to work for stryker.conf.json, however, it is in the schema store.
Upvotes: 0
Views: 1236
Reputation: 11006
VSCode will give intellisense for JSON whenever it has a valid schema to use, hosted at schemastore.org or anywhere else. It just needs to know what schema to use for which files.
As you noted, VSCode just "knows" what schema to use for certain well-known files, like tsconfig.json
.
For other files, you can specify the schema directly in the JSON, which is what VSCode is prompting you to do in your screenshot:
If you don't want to specify the schema in the JSON file itself, you can map file patterns to schemas in settings.json
:
"json.schemas": [
{
"fileMatch": ["stryker.conf.json"],
"url": "https://raw.githubusercontent.com/stryker-mutator/stryker/master/packages/api/schema/stryker-core.json"
}
]
Upvotes: 1