Skip to content

Commit e457596

Browse files
authored
Merge pull request microsoft#80048 from microsoft/aeschli/trailingCommasOnlyForSettingsFiles
trailing commas only for settings files
2 parents da8c3e7 + a7def72 commit e457596

18 files changed

Lines changed: 42 additions & 22 deletions

File tree

extensions/json-language-features/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"jsonc-parser": "^2.1.1",
1616
"request-light": "^0.2.4",
17-
"vscode-json-languageservice": "^3.3.2",
17+
"vscode-json-languageservice": "^3.3.3",
1818
"vscode-languageserver": "^5.3.0-next.8",
1919
"vscode-nls": "^4.1.1",
2020
"vscode-uri": "^2.0.3"

extensions/json-language-features/server/src/jsonServerMain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ function validateTextDocument(textDocument: TextDocument, callback?: (diagnostic
312312
const jsonDocument = getJSONDocument(textDocument);
313313
const version = textDocument.version;
314314

315-
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'ignore' } : { comments: 'error', trailingCommas: 'error' };
315+
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'warning' } : { comments: 'error', trailingCommas: 'error' };
316316
languageService.doValidation(textDocument, jsonDocument, documentSettings).then(diagnostics => {
317317
setTimeout(() => {
318318
const currDocument = documents.get(textDocument.uri);

extensions/json-language-features/server/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ request-light@^0.2.4:
7373
https-proxy-agent "^2.2.1"
7474
vscode-nls "^4.0.0"
7575

76-
vscode-json-languageservice@^3.3.2:
77-
version "3.3.2"
78-
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.2.tgz#2b241b73ead75b001bf90ee5107b1b0a4e47737c"
79-
integrity sha512-+TXVA8KsIzPOZIBV4lI8S/460XihqL26N9hyH7wMOCbEA06W/zfmlZhHSmSJ/Nun9Q/CGLJYZKw4xn+vcuI62A==
76+
vscode-json-languageservice@^3.3.3:
77+
version "3.3.3"
78+
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.3.tgz#f7e512a2cd5e82fecbebf507d6fceaea47661297"
79+
integrity sha512-5vL3OXTUuQpn6+tGd47dopio+7WwbtIZ07zfYMzAUX8eVWPZjfEsLeSWmQk5Xw+vwgu+j5zC4koz5UofLDGGRA==
8080
dependencies:
8181
jsonc-parser "^2.1.1"
8282
vscode-languageserver-types "^3.15.0-next.2"

extensions/json/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
".babelrc",
5151
".jsonc",
5252
".eslintrc",
53-
".eslintrc.json",
54-
"tslint.json"
53+
".eslintrc.json"
5554
],
5655
"configuration": "./language-configuration.json"
5756
}

src/vs/base/common/jsonSchema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export interface IJSONSchema {
6161
markdownDescription?: string; // VSCode extension
6262
doNotSuggest?: boolean; // VSCode extension
6363
allowComments?: boolean; // VSCode extension
64+
allowsTrailingCommas?: boolean; // VSCode extension
6465
}
6566

6667
export interface IJSONSchemaMap {

src/vs/code/browser/workbench/workbench.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/vs/platform/configuration/common/configurationRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class ConfigurationRegistry implements IConfigurationRegistry {
170170
properties: {}
171171
};
172172
this.configurationContributors = [this.defaultOverridesConfigurationNode];
173-
this.editorConfigurationSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting' };
173+
this.editorConfigurationSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting', allowsTrailingCommas: true, allowComments: true };
174174
this.configurationProperties = {};
175175
this.excludedConfigurationProperties = {};
176176
this.computeOverridePropertyPattern();

src/vs/workbench/api/common/configurationExtensionPoint.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ function validateProperties(configuration: IConfigurationNode, extension: IExten
238238
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
239239
jsonRegistry.registerSchema('vscode://schemas/workspaceConfig', {
240240
allowComments: true,
241+
allowsTrailingCommas: true,
241242
default: {
242243
folders: [
243244
{

src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ export class LanguageConfigurationFileHandler {
358358
const schemaId = 'vscode://schemas/language-configuration';
359359
const schema: IJSONSchema = {
360360
allowComments: true,
361+
allowsTrailingCommas: true,
361362
default: {
362363
comments: {
363364
blockComment: ['/*', '*/'],

src/vs/workbench/contrib/debug/common/debugSchemas.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ export const launchSchema: IJSONSchema = {
137137
id: launchSchemaId,
138138
type: 'object',
139139
title: nls.localize('app.launch.json.title', "Launch"),
140+
allowsTrailingCommas: true,
141+
allowComments: true,
140142
required: [],
141143
default: { version: '0.2.0', configurations: [], compounds: [] },
142144
properties: {

0 commit comments

Comments
 (0)