diff --git a/editors/vscode/package.json b/editors/vscode/package.json index adbc0f3e9..b2a71543f 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -46,6 +46,12 @@ "workspace" ], "contributes": { + "jsonValidation": [ + { + "fileMatch": "package.json", + "url": "./schemas/package-json.schema.json" + } + ], "grammars": [ { "language": "toml", diff --git a/editors/vscode/schemas/package-json.schema.json b/editors/vscode/schemas/package-json.schema.json new file mode 100644 index 000000000..ef417b749 --- /dev/null +++ b/editors/vscode/schemas/package-json.schema.json @@ -0,0 +1,52 @@ +{ + "properties": { + "contributes": { + "type": "object", + "properties": { + "tomlValidation": { + "description": "Contributes json schema configuration for TOML.", + "type": "array", + "items": { + "type": "object", + "properties": { + "fileMatch": { + "description": "The file glob pattern (or an array of patterns) to match use glob, for example \"Cargo.toml\".", + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + }, + "regexMatch": { + "description": "The file regular expression pattern (or an array of patterns) to match, for example \"^.*foo.toml$\".", + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + }, + "url": { + "description": "A schema URL ('http:', 'https:') or relative path to the extension folder ('./').", + "type": "string" + } + } + }, + "defaultSnippets": [ + { + "body": [ + { + "regexMatch": "${1:^.*foo.toml$}", + "url": "${2:url}" + } + ] + } + ] + } + } + } + } +} \ No newline at end of file