提交 a7def72d 编写于 作者: M Martin Aeschlimann

trailing commas only for setting files

上级 da8c3e70
......@@ -14,7 +14,7 @@
"dependencies": {
"jsonc-parser": "^2.1.1",
"request-light": "^0.2.4",
"vscode-json-languageservice": "^3.3.2",
"vscode-json-languageservice": "^3.3.3",
"vscode-languageserver": "^5.3.0-next.8",
"vscode-nls": "^4.1.1",
"vscode-uri": "^2.0.3"
......
......@@ -312,7 +312,7 @@ function validateTextDocument(textDocument: TextDocument, callback?: (diagnostic
const jsonDocument = getJSONDocument(textDocument);
const version = textDocument.version;
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'ignore' } : { comments: 'error', trailingCommas: 'error' };
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'warning' } : { comments: 'error', trailingCommas: 'error' };
languageService.doValidation(textDocument, jsonDocument, documentSettings).then(diagnostics => {
setTimeout(() => {
const currDocument = documents.get(textDocument.uri);
......
......@@ -73,10 +73,10 @@ request-light@^0.2.4:
https-proxy-agent "^2.2.1"
vscode-nls "^4.0.0"
vscode-json-languageservice@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.2.tgz#2b241b73ead75b001bf90ee5107b1b0a4e47737c"
integrity sha512-+TXVA8KsIzPOZIBV4lI8S/460XihqL26N9hyH7wMOCbEA06W/zfmlZhHSmSJ/Nun9Q/CGLJYZKw4xn+vcuI62A==
vscode-json-languageservice@^3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.3.tgz#f7e512a2cd5e82fecbebf507d6fceaea47661297"
integrity sha512-5vL3OXTUuQpn6+tGd47dopio+7WwbtIZ07zfYMzAUX8eVWPZjfEsLeSWmQk5Xw+vwgu+j5zC4koz5UofLDGGRA==
dependencies:
jsonc-parser "^2.1.1"
vscode-languageserver-types "^3.15.0-next.2"
......
......@@ -50,8 +50,7 @@
".babelrc",
".jsonc",
".eslintrc",
".eslintrc.json",
"tslint.json"
".eslintrc.json"
],
"configuration": "./language-configuration.json"
}
......
......@@ -61,6 +61,7 @@ export interface IJSONSchema {
markdownDescription?: string; // VSCode extension
doNotSuggest?: boolean; // VSCode extension
allowComments?: boolean; // VSCode extension
allowsTrailingCommas?: boolean; // VSCode extension
}
export interface IJSONSchemaMap {
......
......@@ -26,7 +26,13 @@
amdLoader(['vs/workbench/workbench.web.api'], function (api) {
const options = JSON.parse(document.getElementById('vscode-workbench-web-configuration').getAttribute('data-settings'));
options.staticExtensions = [{
packageJSON: JSON.parse('{"name":"errorlens","displayName":"Error Lens","description":"Improve highlighting of errors, warnings and other language diagnostics.","version":"2.7.0","publisher":"usernamehw","license":"MIT","engines":{"vscode":"^1.30.0"},"categories":["Other"],"keywords":["highlight","problems","error","warning","diagnostics","gutter","multi-root ready"],"galleryBanner":{"color":"#332020","theme":"dark"},"icon":"img/icon.png","repository":{"type":"git","url":"https://github.com/usernamehw/vscode-error-lens"},"activationEvents":["*"],"main":"./dist/extension","contributes":{"commands":[{"command":"errorLens.toggle","title":"Toggle (Enable/Disable) All Decorations","category":"Error Lens"},{"command":"errorLens.toggleError","title":"Toggle Errors","category":"Error Lens"},{"command":"errorLens.toggleWarning","title":"Toggle Warnings","category":"Error Lens"},{"command":"errorLens.toggleInfo","title":"Toggle Info","category":"Error Lens"},{"command":"errorLens.toggleHint","title":"Toggle Hint","category":"Error Lens"},{"command":"errorLens.copyProblemMessage","title":"Copy Problem Message","category":"Error Lens"}],"configuration":{"properties":{"errorLens.errorBackground":{"type":"string","default":"#e4545420","description":"Background color used to highlight lines containing errors."},"errorLens.errorForeground":{"type":"string","default":"#e45454","description":"Text color used to highlight lines containing errors."},"errorLens.warningBackground":{"type":"string","default":"#ff942f20","description":"Background color used to highlight lines containing warnings."},"errorLens.warningForeground":{"type":"string","default":"#ff942f","description":"Text color used to highlight lines containing warnings."},"errorLens.infoBackground":{"type":"string","default":"#00b7e420","description":"Background color used to highlight lines containing info."},"errorLens.infoForeground":{"type":"string","default":"#00b7e4","description":"Text color used to highlight lines containing info."},"errorLens.hintBackground":{"type":"string","default":"#17a2a220","description":"Background color used to highlight lines containing hints."},"errorLens.hintForeground":{"type":"string","default":"#17a2a2","description":"Text color used to highlight lines containing hints."},"errorLens.fontFamily":{"type":"string","default":"","description":"Font family of problem messages."},"errorLens.fontWeight":{"type":"string","enum":["100","200","300","400","normal","500","600","700","bold","800","900"],"default":"normal","description":"Specifies the font weight for ErrorLens annotations."},"errorLens.fontStyleItalic":{"type":"boolean","default":false,"description":"Show ErrorLens annotations in Italics, or not?"},"errorLens.fontSize":{"type":"string","default":"","description":"Font size for text (problem messages)."},"errorLens.margin":{"type":"string","default":"30px","description":"Distance between the end of the line and the start of annotation. (CSS units)"},"errorLens.enabledDiagnosticLevels":{"type":"array","items":{"type":"string","enum":["error","warning","info","hint"]},"description":"Specify which diagnostic levels are enhanced. e.g. [ \'error\', \'warning\' ]. Valid values are any or all of: \'error\', \'warning\', \'info\' & \'hint\'","default":["error","warning","info","hint"]},"errorLens.addAnnotationTextPrefixes":{"type":"boolean","description":"If \'true\', prefixes the diagnostic severity (\'ERROR:\', \'WARNING:\' etc) to ErrorLens annotations.","default":false},"errorLens.exclude":{"type":"array","default":[],"items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"code":{"type":"string"},"source":{"type":"string"}}}]},"description":"Specify messages that should not be highlighted."},"errorLens.light":{"type":"object","description":"Specify color of decorations for when the light color theme is active.","properties":{"errorBackground":{"type":"string","default":"","description":"Background color used to highlight lines containing errors."},"errorForeground":{"type":"string","default":"","description":"Text color used to highlight lines containing errors."},"warningBackground":{"type":"string","default":"","description":"Background color used to highlight lines containing warnings."},"warningForeground":{"type":"string","default":"","description":"Text color used to highlight lines containing warnings."},"infoBackground":{"type":"string","default":"","description":"Background color used to highlight lines containing info."},"infoForeground":{"type":"string","default":"","description":"Text color used to highlight lines containing info."},"hintBackground":{"type":"string","default":"","description":"Background color used to highlight lines containing hints."},"hintForeground":{"type":"string","default":"","description":"Text color used to highlight lines containing hints."},"errorGutterIconPath":{"type":"string","description":"Absolute path to error gutter icon for light themes."},"warningGutterIconPath":{"type":"string","description":"Absolute path to warning gutter icon for light themes."},"infoGutterIconPath":{"type":"string","description":"Absolute path to info gutter icon for light themes."},"errorGutterIconColor":{"type":"string","default":"#e45454","markdownDescription":"Error color of `circle` gutter icon set for light themes."},"warningGutterIconColor":{"type":"string","default":"#ff942f","markdownDescription":"Warning color of `circle` gutter icon set for light themes."},"infoGutterIconColor":{"type":"string","default":"#00b7e4","markdownDescription":"Info color of `circle` gutter icon set for light themes."}}},"errorLens.delay":{"type":"number","description":"Delay before showing problem decorations.","default":0},"errorLens.clearDecorations":{"type":"boolean","markdownDescription":"Works only when `delay` is set. When set to `true` extension clears all decorations at the time when diagnostic changes (but it could cause flickering if the delay is < 500). When set to `false` - decorations are not cleared and delay applied to clearing decorations also (but that causes messages being on screen even if the problem was solved).","default":false},"errorLens.onSave":{"type":"boolean","description":"If `true` - update decorations only on save.","default":false},"errorLens.followCursor":{"type":"string","enum":["allLines","activeLine","closestProblem"],"enumDescriptions":["Highlight all problems in file","Highlight only the problem at the cursor","Highlight only closest to the cursor problem"],"description":"Highlight only portion of the problems.","default":"allLines"},"errorLens.followCursorMore":{"type":"number","markdownDescription":"Augments `followCursor`.\\nAdds number of lines to top and bottom when `followCursor` is `activeLine`.\\n Adds number of closest problems when `followCursor` is `closestProblem`","default":0},"errorLens.gutterIconsEnabled":{"type":"boolean","description":"If `true` - show error/warning/info icons in the gutter (In place of debug breakpoint icon).","default":false},"errorLens.gutterIconSize":{"type":"string","markdownDescription":"Change gutter icon size. Examples: `auto`, `contain`, `cover`, `50%`, `150%`","default":"100%"},"errorLens.gutterIconSet":{"type":"string","description":"Change gutter icon style.","enum":["default","borderless","circle"],"enumDescriptions":["Should be similar to vscode icons in Problems Panel.","Should be similar to vscode icons in Problems Panel only without a border.","A simple filled circle."],"default":"default"},"errorLens.errorGutterIconPath":{"type":"string","description":"Absolute path to error gutter icon."},"errorLens.warningGutterIconPath":{"type":"string","description":"Absolute path to warning gutter icon."},"errorLens.infoGutterIconPath":{"type":"string","description":"Absolute path to info gutter icon."},"errorLens.errorGutterIconColor":{"type":"string","default":"#e45454","markdownDescription":"Error color of `circle` gutter icon set."},"errorLens.warningGutterIconColor":{"type":"string","default":"#ff942f","markdownDescription":"Warning color of `circle` gutter icon set."},"errorLens.infoGutterIconColor":{"type":"string","default":"#00b7e4","markdownDescription":"Info color of `circle` gutter icon set."},"errorLens.editorActiveTabDecorationEnabled":{"type":"boolean","default":false,"markdownDescription":"When `true` - updates `tab.activeBackground` if the file has errors"},"errorLens.editorActiveTabErrorBackground":{"type":"string","default":null,"markdownDescription":""},"errorLens.editorActiveTabWarningBackground":{"type":"string","default":null,"markdownDescription":""}}}},"scripts":{"vscode:prepublish":"webpack --mode production --colors","compile":"webpack --mode development","watch":"webpack --mode development --watch --display=minimal"},"devDependencies":{"@types/lodash":"^4.14.136","@types/node":"^10.14.12","@types/vscode":"^1.30.0","friendly-errors-webpack-plugin":"^1.7.0","ts-loader":"^6.0.4","tslint":"^5.18.0","typescript":"^3.5.3","webpack":"^4.35.3","webpack-cli":"^3.3.5","webpack-strip-block":"^0.2.0"},"dependencies":{"lodash":"^4.17.14"},"__metadata":{"id":"9d8c32ab-354c-4daf-a9bf-20b633734435","publisherId":"151820df-5dc5-4c97-8751-eb84643203fa","publisherDisplayName":"Alexander"}}'),
extensionLocation: { scheme: 'https', authority: 'jriekenextensionscdn.blob.core.windows.net', path: '/$web/usernamehw.errorlens-2.7.0' }
}, {
packageJSON: JSON.parse('{"name":"helloworld","displayName":"HelloWorld","description":"","publisher":"jrieken","version":"0.0.8","engines":{"vscode":"^1.33.0"},"categories":["Other"],"activationEvents":["onCommand:extension.hellowebworker"],"main":"./out/extension.js","contributes":{"commands":[{"command":"extension.hellowebworker","title":"Hello Webworker","icon":"./icons/tree-collapsed-light.svg"}],"menus":{"editor/title":[{"command":"extension.hellowebworker","group":"navigation"}]},"snippets":[{"path":"snippets/foo.code-snippets"}]},"scripts":{"vscode:prepublish":"npm run compile","compile":"tsc -p ./","watch":"tsc -watch -p ./","postinstall":"node ./node_modules/vscode/bin/install","test":"npm run compile && node ./node_modules/vscode/bin/test"},"devDependencies":{"typescript":"^3.3.1","vscode":"^1.1.28","tslint":"^5.12.1","@types/node":"^10.12.21","@types/mocha":"^2.2.42"}}'),
extensionLocation: { scheme: 'https', authority: 'jriekenextensionscdn.blob.core.windows.net', path: '/$web/jrieken.helloworld-0.0.8' }
}];
api.create(document.body, options);
});
})();
......@@ -170,7 +170,7 @@ class ConfigurationRegistry implements IConfigurationRegistry {
properties: {}
};
this.configurationContributors = [this.defaultOverridesConfigurationNode];
this.editorConfigurationSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting' };
this.editorConfigurationSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting', allowsTrailingCommas: true, allowComments: true };
this.configurationProperties = {};
this.excludedConfigurationProperties = {};
this.computeOverridePropertyPattern();
......
......@@ -238,6 +238,7 @@ function validateProperties(configuration: IConfigurationNode, extension: IExten
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
jsonRegistry.registerSchema('vscode://schemas/workspaceConfig', {
allowComments: true,
allowsTrailingCommas: true,
default: {
folders: [
{
......
......@@ -358,6 +358,7 @@ export class LanguageConfigurationFileHandler {
const schemaId = 'vscode://schemas/language-configuration';
const schema: IJSONSchema = {
allowComments: true,
allowsTrailingCommas: true,
default: {
comments: {
blockComment: ['/*', '*/'],
......
......@@ -137,6 +137,8 @@ export const launchSchema: IJSONSchema = {
id: launchSchemaId,
type: 'object',
title: nls.localize('app.launch.json.title', "Launch"),
allowsTrailingCommas: true,
allowComments: true,
required: [],
default: { version: '0.2.0', configurations: [], compounds: [] },
properties: {
......
......@@ -11,6 +11,7 @@ export const ExtensionsConfigurationSchemaId = 'vscode://schemas/extensions';
export const ExtensionsConfigurationSchema: IJSONSchema = {
id: ExtensionsConfigurationSchemaId,
allowComments: true,
allowsTrailingCommas: true,
type: 'object',
title: localize('app.extensions.json.title', "Extensions"),
additionalProperties: false,
......
......@@ -232,6 +232,7 @@ function registerLocaleDefinitionSchema(languages: string[]): void {
jsonRegistry.registerSchema(localeDefinitionFileSchemaId, {
id: localeDefinitionFileSchemaId,
allowComments: true,
allowsTrailingCommas: true,
description: 'Locale Definition file',
type: 'object',
default: {
......
......@@ -28,6 +28,7 @@ const languageScopeSchemaId = 'vscode://schemas/snippets';
const languageScopeSchema: IJSONSchema = {
id: languageScopeSchemaId,
allowComments: true,
allowsTrailingCommas: true,
defaultSnippets: [{
label: nls.localize('snippetSchema.json.default', "Empty snippet"),
body: { '${1:snippetName}': { 'prefix': '${2:prefix}', 'body': '${3:snippet}', 'description': '${4:description}' } }
......@@ -63,6 +64,7 @@ const globalSchemaId = 'vscode://schemas/global-snippets';
const globalSchema: IJSONSchema = {
id: globalSchemaId,
allowComments: true,
allowsTrailingCommas: true,
defaultSnippets: [{
label: nls.localize('snippetSchema.json.default', "Empty snippet"),
body: { '${1:snippetName}': { 'scope': '${2:scope}', 'prefix': '${3:prefix}', 'body': '${4:snippet}', 'description': '${5:description}' } }
......
......@@ -260,6 +260,8 @@ let schema: IJSONSchema = {
id: schemaId,
description: 'Task definition file',
type: 'object',
allowsTrailingCommas: true,
allowComments: true,
default: {
version: '2.0.0',
tasks: [
......
......@@ -507,17 +507,17 @@ export class WorkspaceService extends Disposable implements IConfigurationServic
private registerConfigurationSchemas(): void {
if (this.workspace) {
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
const allSettingsSchema: IJSONSchema = { properties: allSettings.properties, patternProperties: allSettings.patternProperties, additionalProperties: true };
const userSettingsSchema: IJSONSchema = this.remoteUserConfiguration ? { properties: { ...applicationSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true } : allSettingsSchema;
const machineSettingsSchema: IJSONSchema = { properties: { ...machineSettings.properties, ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true };
const workspaceSettingsSchema: IJSONSchema = { properties: { ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true };
const allSettingsSchema: IJSONSchema = { properties: allSettings.properties, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true };
const userSettingsSchema: IJSONSchema = this.remoteUserConfiguration ? { properties: { ...applicationSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true } : allSettingsSchema;
const machineSettingsSchema: IJSONSchema = { properties: { ...machineSettings.properties, ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true };
const workspaceSettingsSchema: IJSONSchema = { properties: { ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true };
jsonRegistry.registerSchema(defaultSettingsSchemaId, allSettingsSchema);
jsonRegistry.registerSchema(userSettingsSchemaId, userSettingsSchema);
jsonRegistry.registerSchema(machineSettingsSchemaId, machineSettingsSchema);
if (WorkbenchState.WORKSPACE === this.getWorkbenchState()) {
const folderSettingsSchema: IJSONSchema = { properties: { ...machineOverridableSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true };
const folderSettingsSchema: IJSONSchema = { properties: { ...machineOverridableSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true };
jsonRegistry.registerSchema(workspaceSettingsSchemaId, workspaceSettingsSchema);
jsonRegistry.registerSchema(folderSettingsSchemaId, folderSettingsSchema);
} else {
......
......@@ -602,10 +602,12 @@ let commandsSchemas: IJSONSchema[] = [];
let commandsEnum: string[] = [];
let commandsEnumDescriptions: (string | undefined)[] = [];
let schema: IJSONSchema = {
'id': schemaId,
'type': 'array',
'title': nls.localize('keybindings.json.title', "Keybindings configuration"),
'definitions': {
id: schemaId,
type: 'array',
title: nls.localize('keybindings.json.title', "Keybindings configuration"),
allowsTrailingCommas: true,
allowComments: true,
definitions: {
'editorGroupsSchema': {
'type': 'array',
'items': {
......@@ -623,7 +625,7 @@ let schema: IJSONSchema = {
}
}
},
'items': {
items: {
'required': ['key'],
'type': 'object',
'defaultSnippets': [{ 'body': { 'key': '$1', 'command': '$2', 'when': '$3' } }],
......
......@@ -192,6 +192,7 @@ export const colorThemeSchemaId = 'vscode://schemas/color-theme';
const colorThemeSchema: IJSONSchema = {
type: 'object',
allowComments: true,
allowsTrailingCommas: true,
properties: {
colors: {
description: nls.localize('schema.workbenchColors', 'Colors in the workbench'),
......
......@@ -12,6 +12,7 @@ const schemaId = 'vscode://schemas/icon-theme';
const schema: IJSONSchema = {
type: 'object',
allowComments: true,
allowsTrailingCommas: true,
definitions: {
folderExpanded: {
type: 'string',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册