I am trying to configure JSON5 schemas in my settings.json file in VS Code, [to have intellisense]
I would like to do something similar to what is available today for JSON editing https://code.visualstudio.com/docs/languages/json#_mapping-in-the-user-settings, something like the below
"json5.schemas": [
{
"fileMatch": [
"*test.json5"
],
"url": "https://example.com/json-schemas/example.json5"
}
]
Could you please help me achieve this (by any means within VSCode)?
Motivation: Please note as of this post, IntelliJ IDEA supports JSON5 https://www.jetbrains.com/help/idea/json.html#ws_json_choose_version
I've forked VS Code's builtin JSON extension into Better JSON5 extension (sorry for the extension name, I couldn't think of anything better at that time) on the marketplace, which might fit your needs. You can access the GitHub repository for the code.
For example, with the extension and the following workspace layout:
.vscode
\_ settings.json
schema
\_ npm-pkg.schema.json5 (A local copy of https://www.schemastore.org/package)
first_test.json5
second_test.json5
// .vscode/settings.json
{
"json5.schemas": [
{
"fileMatch": [
"*test.json5",
],
"url": "./schema/npm-pkg.schema.json5"
// for local file resolution demonstration, http(s) URLs are equivalent
}
]
}
You can have completions and validations like these: