提交 736ff0bd 编写于 作者: M Martin Aeschlimann

[json] move schema associations to extensions

上级 89824341
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
"language": "csharp", "language": "csharp",
"scopeName": "source.cs", "scopeName": "source.cs",
"path": "./syntaxes/csharp.json" "path": "./syntaxes/csharp.json"
}],
"jsonValidation": [{
"fileMatch": "project.json",
"url": "http://json.schemastore.org/project"
}] }]
} }
} }
\ No newline at end of file
...@@ -2,37 +2,86 @@ ...@@ -2,37 +2,86 @@
"name": "javascript", "name": "javascript",
"version": "0.1.0", "version": "0.1.0",
"publisher": "vscode", "publisher": "vscode",
"engines": { "vscode": "*" }, "engines": {
"vscode": "*"
},
"contributes": { "contributes": {
"languages": [{ "languages": [
"id": "javascriptreact", {
"aliases": ["JavaScript React","jsx"], "id": "javascriptreact",
"extensions": [".jsx"], "aliases": [
"configuration": "./javascript.configuration.json" "JavaScript React",
},{ "jsx"
"id": "javascript", ],
"aliases": ["JavaScript", "javascript", "js"], "extensions": [
"extensions": [".js", ".es6"], ".jsx"
"filenames": ["jakefile"], ],
"firstLine": "^#!.*\\bnode", "configuration": "./javascript.configuration.json"
"mimetypes": ["text/javascript"] },
}], {
"grammars": [{ "id": "javascript",
"language": "javascriptreact", "aliases": [
"scopeName": "source.jsx", "JavaScript",
"path": "./syntaxes/JavaScriptReact.tmLanguage" "javascript",
},{ "js"
"language": "javascript", ],
"scopeName": "source.js", "extensions": [
"path": "./syntaxes/JavaScript.tmLanguage" ".js",
},{ ".es6"
// referenced by other grammars ],
"scopeName": "source.js.regexp", "filenames": [
"path": "./syntaxes/Regular Expressions (JavaScript).tmLanguage" "jakefile"
}], ],
"snippets": [{ "firstLine": "^#!.*\\bnode",
"language": "javascript", "mimetypes": [
"path": "./snippets/javascript.json" "text/javascript"
}] ]
}
],
"grammars": [
{
"language": "javascriptreact",
"scopeName": "source.jsx",
"path": "./syntaxes/JavaScriptReact.tmLanguage"
},
{
"language": "javascript",
"scopeName": "source.js",
"path": "./syntaxes/JavaScript.tmLanguage"
},
{
// referenced by other grammars
"scopeName": "source.js.regexp",
"path": "./syntaxes/Regular Expressions (JavaScript).tmLanguage"
}
],
"snippets": [
{
"language": "javascript",
"path": "./snippets/javascript.json"
}
],
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "http://json.schemastore.org/project"
},
{
"fileMatch": "bower.json",
"url": "http://json.schemastore.org/bower"
},
{
"fileMatch": ".bower.json",
"url": "http://json.schemastore.org/bower"
},
{
"fileMatch": ".bowerrc",
"url": "http://json.schemastore.org/bowerrc"
},
{
"fileMatch": "jsconfig.json",
"url": "./schemas/jsconfig.schema.json"
}
]
} }
} }
\ No newline at end of file
{
"title": "JSON schema for the JavaScript configuration file",
"type": "object",
"default": {
"compilerOptions": {
"target": "ES5"
}
},
"properties": {
"compilerOptions": {
"type": "object",
"description": "Instructs the JavaScript language service how to validate .js files",
"properties": {
"charset": {
"description": "The character set of the input files",
"type": "string"
},
"diagnostics": {
"description": "Show diagnostic information.",
"type": "boolean"
},
"locale": {
"description": "The locale to use to show error messages, e.g. en-us.",
"type": "string"
},
"mapRoot": {
"description": "Specifies the location where debugger should locate map files instead of generated locations",
"type": "string",
"format": "uri"
},
"module": {
"description": "Module code generation to resolve against: 'commonjs', 'amd', 'system', or 'umd'.",
"enum": [
"commonjs",
"amd",
"system",
"umd"
]
},
"noLib": {
"description": "Do not include the default library file (lib.d.ts).",
"type": "boolean"
},
"target": {
"description": "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental).",
"enum": [
"ES3",
"ES5",
"ES6",
"es3",
"es5",
"es6"
],
"default": "ES3"
},
"experimentalDecorators": {
"description": "Enables experimental support for ES7 decorators.",
"type": "boolean"
}
}
},
"files": {
"type": "array",
"description": "If no 'files' property is present in a jsconfig.json, the language service defaults to including all files the containing directory and subdirectories. When a 'files' property is specified, only those files are included.",
"items": {
"type": "string",
"format": "uri"
}
},
"exclude": {
"type": "array",
"description": "List files and folders that should not be included. This property is not honored when the 'files' property is present.",
"items": {
"type": "string",
"format": "uri"
}
}
}
}
\ No newline at end of file
...@@ -2,18 +2,41 @@ ...@@ -2,18 +2,41 @@
"name": "json", "name": "json",
"version": "0.1.0", "version": "0.1.0",
"publisher": "vscode", "publisher": "vscode",
"engines": { "vscode": "*" }, "engines": {
"vscode": "*"
},
"contributes": { "contributes": {
"languages": [{ "languages": [
"id": "json", {
"aliases": ["JSON", "json"], "id": "json",
"extensions": [".json", ".bowerrc", ".jshintrc", ".jscsrc", ".eslintrc"], "aliases": [
"mimetypes": ["application/json"] "JSON",
}], "json"
"grammars": [{ ],
"language": "json", "extensions": [
"scopeName": "source.json", ".json",
"path": "./syntaxes/JSON.tmLanguage" ".bowerrc",
}] ".jshintrc",
".jscsrc",
".eslintrc"
],
"mimetypes": [
"application/json"
]
}
],
"grammars": [
{
"language": "json",
"scopeName": "source.json",
"path": "./syntaxes/JSON.tmLanguage"
}
],
"jsonValidation": [
{
"fileMatch": "*.schema.json",
"url": "http://json-schema.org/draft-04/schema#"
}
]
} }
} }
\ No newline at end of file
...@@ -101,6 +101,12 @@ ...@@ -101,6 +101,12 @@
"language": "typescriptreact", "language": "typescriptreact",
"path": "./snippets/typescriptreact.json" "path": "./snippets/typescriptreact.json"
} }
],
"jsonValidation": [
{
"fileMatch": "tsconfig.json",
"url": "http://json.schemastore.org/tsconfig"
}
] ]
} }
} }
\ No newline at end of file
...@@ -71,7 +71,11 @@ export class JSONValidationExtensionPoint { ...@@ -71,7 +71,11 @@ export class JSONValidationExtensionPoint {
collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must start with 'http:', 'https:' or './' to reference schemas located in the extension")); collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must start with 'http:', 'https:' or './' to reference schemas located in the extension"));
return; return;
} }
schemaRegistry.addSchemaFileAssociation(extension.fileMatch, uri); var fileMatch = extension.fileMatch;
if (!strings.startsWith(extension.fileMatch, '/')) {
fileMatch = '/' + fileMatch;
}
schemaRegistry.addSchemaFileAssociation(fileMatch, uri);
}); });
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册