vscode-json-languageservice 5.0.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/lib/esm/jsonContributions.d.ts +17 -17
  3. package/lib/esm/jsonContributions.js +1 -1
  4. package/lib/esm/jsonLanguageService.d.ts +29 -29
  5. package/lib/esm/jsonLanguageService.js +66 -66
  6. package/lib/esm/jsonLanguageTypes.d.ts +292 -279
  7. package/lib/esm/jsonLanguageTypes.js +55 -46
  8. package/lib/esm/jsonSchema.d.ts +89 -89
  9. package/lib/esm/jsonSchema.js +1 -1
  10. package/lib/esm/parser/jsonParser.js +1236 -1214
  11. package/lib/esm/services/configuration.js +528 -528
  12. package/lib/esm/services/jsonCompletion.js +924 -918
  13. package/lib/esm/services/jsonDocumentSymbols.js +267 -267
  14. package/lib/esm/services/jsonFolding.js +120 -120
  15. package/lib/esm/services/jsonHover.js +109 -109
  16. package/lib/esm/services/jsonLinks.js +72 -72
  17. package/lib/esm/services/jsonSchemaService.js +593 -586
  18. package/lib/esm/services/jsonSelectionRanges.js +61 -61
  19. package/lib/esm/services/jsonValidation.js +151 -151
  20. package/lib/esm/utils/colors.js +68 -68
  21. package/lib/esm/utils/glob.js +124 -124
  22. package/lib/esm/utils/json.js +42 -42
  23. package/lib/esm/utils/objects.js +68 -68
  24. package/lib/esm/utils/strings.js +79 -64
  25. package/lib/umd/jsonContributions.d.ts +17 -17
  26. package/lib/umd/jsonContributions.js +12 -12
  27. package/lib/umd/jsonLanguageService.d.ts +29 -29
  28. package/lib/umd/jsonLanguageService.js +94 -90
  29. package/lib/umd/jsonLanguageTypes.d.ts +292 -279
  30. package/lib/umd/jsonLanguageTypes.js +103 -93
  31. package/lib/umd/jsonSchema.d.ts +89 -89
  32. package/lib/umd/jsonSchema.js +12 -12
  33. package/lib/umd/parser/jsonParser.js +1265 -1243
  34. package/lib/umd/services/configuration.js +541 -541
  35. package/lib/umd/services/jsonCompletion.js +938 -932
  36. package/lib/umd/services/jsonDocumentSymbols.js +281 -281
  37. package/lib/umd/services/jsonFolding.js +134 -134
  38. package/lib/umd/services/jsonHover.js +123 -123
  39. package/lib/umd/services/jsonLinks.js +86 -86
  40. package/lib/umd/services/jsonSchemaService.js +609 -602
  41. package/lib/umd/services/jsonSelectionRanges.js +75 -75
  42. package/lib/umd/services/jsonValidation.js +165 -165
  43. package/lib/umd/utils/colors.js +84 -84
  44. package/lib/umd/utils/glob.js +138 -138
  45. package/lib/umd/utils/json.js +56 -56
  46. package/lib/umd/utils/objects.js +87 -87
  47. package/lib/umd/utils/strings.js +98 -82
  48. package/package.json +11 -10
@@ -1,75 +1,75 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- (function (factory) {
6
- if (typeof module === "object" && typeof module.exports === "object") {
7
- var v = factory(require, exports);
8
- if (v !== undefined) module.exports = v;
9
- }
10
- else if (typeof define === "function" && define.amd) {
11
- define(["require", "exports", "../jsonLanguageTypes", "jsonc-parser"], factory);
12
- }
13
- })(function (require, exports) {
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.getSelectionRanges = void 0;
17
- const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
18
- const jsonc_parser_1 = require("jsonc-parser");
19
- function getSelectionRanges(document, positions, doc) {
20
- function getSelectionRange(position) {
21
- let offset = document.offsetAt(position);
22
- let node = doc.getNodeFromOffset(offset, true);
23
- const result = [];
24
- while (node) {
25
- switch (node.type) {
26
- case 'string':
27
- case 'object':
28
- case 'array':
29
- // range without ", [ or {
30
- const cStart = node.offset + 1, cEnd = node.offset + node.length - 1;
31
- if (cStart < cEnd && offset >= cStart && offset <= cEnd) {
32
- result.push(newRange(cStart, cEnd));
33
- }
34
- result.push(newRange(node.offset, node.offset + node.length));
35
- break;
36
- case 'number':
37
- case 'boolean':
38
- case 'null':
39
- case 'property':
40
- result.push(newRange(node.offset, node.offset + node.length));
41
- break;
42
- }
43
- if (node.type === 'property' || node.parent && node.parent.type === 'array') {
44
- const afterCommaOffset = getOffsetAfterNextToken(node.offset + node.length, 5 /* CommaToken */);
45
- if (afterCommaOffset !== -1) {
46
- result.push(newRange(node.offset, afterCommaOffset));
47
- }
48
- }
49
- node = node.parent;
50
- }
51
- let current = undefined;
52
- for (let index = result.length - 1; index >= 0; index--) {
53
- current = jsonLanguageTypes_1.SelectionRange.create(result[index], current);
54
- }
55
- if (!current) {
56
- current = jsonLanguageTypes_1.SelectionRange.create(jsonLanguageTypes_1.Range.create(position, position));
57
- }
58
- return current;
59
- }
60
- function newRange(start, end) {
61
- return jsonLanguageTypes_1.Range.create(document.positionAt(start), document.positionAt(end));
62
- }
63
- const scanner = (0, jsonc_parser_1.createScanner)(document.getText(), true);
64
- function getOffsetAfterNextToken(offset, expectedToken) {
65
- scanner.setPosition(offset);
66
- let token = scanner.scan();
67
- if (token === expectedToken) {
68
- return scanner.getTokenOffset() + scanner.getTokenLength();
69
- }
70
- return -1;
71
- }
72
- return positions.map(getSelectionRange);
73
- }
74
- exports.getSelectionRanges = getSelectionRanges;
75
- });
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ (function (factory) {
6
+ if (typeof module === "object" && typeof module.exports === "object") {
7
+ var v = factory(require, exports);
8
+ if (v !== undefined) module.exports = v;
9
+ }
10
+ else if (typeof define === "function" && define.amd) {
11
+ define(["require", "exports", "../jsonLanguageTypes", "jsonc-parser"], factory);
12
+ }
13
+ })(function (require, exports) {
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getSelectionRanges = void 0;
17
+ const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
18
+ const jsonc_parser_1 = require("jsonc-parser");
19
+ function getSelectionRanges(document, positions, doc) {
20
+ function getSelectionRange(position) {
21
+ let offset = document.offsetAt(position);
22
+ let node = doc.getNodeFromOffset(offset, true);
23
+ const result = [];
24
+ while (node) {
25
+ switch (node.type) {
26
+ case 'string':
27
+ case 'object':
28
+ case 'array':
29
+ // range without ", [ or {
30
+ const cStart = node.offset + 1, cEnd = node.offset + node.length - 1;
31
+ if (cStart < cEnd && offset >= cStart && offset <= cEnd) {
32
+ result.push(newRange(cStart, cEnd));
33
+ }
34
+ result.push(newRange(node.offset, node.offset + node.length));
35
+ break;
36
+ case 'number':
37
+ case 'boolean':
38
+ case 'null':
39
+ case 'property':
40
+ result.push(newRange(node.offset, node.offset + node.length));
41
+ break;
42
+ }
43
+ if (node.type === 'property' || node.parent && node.parent.type === 'array') {
44
+ const afterCommaOffset = getOffsetAfterNextToken(node.offset + node.length, 5 /* SyntaxKind.CommaToken */);
45
+ if (afterCommaOffset !== -1) {
46
+ result.push(newRange(node.offset, afterCommaOffset));
47
+ }
48
+ }
49
+ node = node.parent;
50
+ }
51
+ let current = undefined;
52
+ for (let index = result.length - 1; index >= 0; index--) {
53
+ current = jsonLanguageTypes_1.SelectionRange.create(result[index], current);
54
+ }
55
+ if (!current) {
56
+ current = jsonLanguageTypes_1.SelectionRange.create(jsonLanguageTypes_1.Range.create(position, position));
57
+ }
58
+ return current;
59
+ }
60
+ function newRange(start, end) {
61
+ return jsonLanguageTypes_1.Range.create(document.positionAt(start), document.positionAt(end));
62
+ }
63
+ const scanner = (0, jsonc_parser_1.createScanner)(document.getText(), true);
64
+ function getOffsetAfterNextToken(offset, expectedToken) {
65
+ scanner.setPosition(offset);
66
+ let token = scanner.scan();
67
+ if (token === expectedToken) {
68
+ return scanner.getTokenOffset() + scanner.getTokenLength();
69
+ }
70
+ return -1;
71
+ }
72
+ return positions.map(getSelectionRange);
73
+ }
74
+ exports.getSelectionRanges = getSelectionRanges;
75
+ });
@@ -1,165 +1,165 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- (function (factory) {
6
- if (typeof module === "object" && typeof module.exports === "object") {
7
- var v = factory(require, exports);
8
- if (v !== undefined) module.exports = v;
9
- }
10
- else if (typeof define === "function" && define.amd) {
11
- define(["require", "exports", "../jsonLanguageTypes", "vscode-nls", "../utils/objects"], factory);
12
- }
13
- })(function (require, exports) {
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.JSONValidation = void 0;
17
- const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
18
- const nls = require("vscode-nls");
19
- const objects_1 = require("../utils/objects");
20
- const localize = nls.loadMessageBundle();
21
- class JSONValidation {
22
- constructor(jsonSchemaService, promiseConstructor) {
23
- this.jsonSchemaService = jsonSchemaService;
24
- this.promise = promiseConstructor;
25
- this.validationEnabled = true;
26
- }
27
- configure(raw) {
28
- if (raw) {
29
- this.validationEnabled = raw.validate !== false;
30
- this.commentSeverity = raw.allowComments ? undefined : jsonLanguageTypes_1.DiagnosticSeverity.Error;
31
- }
32
- }
33
- doValidation(textDocument, jsonDocument, documentSettings, schema) {
34
- if (!this.validationEnabled) {
35
- return this.promise.resolve([]);
36
- }
37
- const diagnostics = [];
38
- const added = {};
39
- const addProblem = (problem) => {
40
- // remove duplicated messages
41
- const signature = problem.range.start.line + ' ' + problem.range.start.character + ' ' + problem.message;
42
- if (!added[signature]) {
43
- added[signature] = true;
44
- diagnostics.push(problem);
45
- }
46
- };
47
- const getDiagnostics = (schema) => {
48
- let trailingCommaSeverity = documentSettings?.trailingCommas ? toDiagnosticSeverity(documentSettings.trailingCommas) : jsonLanguageTypes_1.DiagnosticSeverity.Error;
49
- let commentSeverity = documentSettings?.comments ? toDiagnosticSeverity(documentSettings.comments) : this.commentSeverity;
50
- let schemaValidation = documentSettings?.schemaValidation ? toDiagnosticSeverity(documentSettings.schemaValidation) : jsonLanguageTypes_1.DiagnosticSeverity.Warning;
51
- let schemaRequest = documentSettings?.schemaRequest ? toDiagnosticSeverity(documentSettings.schemaRequest) : jsonLanguageTypes_1.DiagnosticSeverity.Warning;
52
- if (schema) {
53
- const addSchemaProblem = (errorMessage, errorCode) => {
54
- if (jsonDocument.root && schemaRequest) {
55
- const astRoot = jsonDocument.root;
56
- const property = astRoot.type === 'object' ? astRoot.properties[0] : undefined;
57
- if (property && property.keyNode.value === '$schema') {
58
- const node = property.valueNode || property;
59
- const range = jsonLanguageTypes_1.Range.create(textDocument.positionAt(node.offset), textDocument.positionAt(node.offset + node.length));
60
- addProblem(jsonLanguageTypes_1.Diagnostic.create(range, errorMessage, schemaRequest, errorCode));
61
- }
62
- else {
63
- const range = jsonLanguageTypes_1.Range.create(textDocument.positionAt(astRoot.offset), textDocument.positionAt(astRoot.offset + 1));
64
- addProblem(jsonLanguageTypes_1.Diagnostic.create(range, errorMessage, schemaRequest, errorCode));
65
- }
66
- }
67
- };
68
- if (schema.errors.length) {
69
- addSchemaProblem(schema.errors[0], jsonLanguageTypes_1.ErrorCode.SchemaResolveError);
70
- }
71
- else if (schemaValidation) {
72
- for (const warning of schema.warnings) {
73
- addSchemaProblem(warning, jsonLanguageTypes_1.ErrorCode.SchemaUnsupportedFeature);
74
- }
75
- const semanticErrors = jsonDocument.validate(textDocument, schema.schema, schemaValidation);
76
- if (semanticErrors) {
77
- semanticErrors.forEach(addProblem);
78
- }
79
- }
80
- if (schemaAllowsComments(schema.schema)) {
81
- commentSeverity = undefined;
82
- }
83
- if (schemaAllowsTrailingCommas(schema.schema)) {
84
- trailingCommaSeverity = undefined;
85
- }
86
- }
87
- for (const p of jsonDocument.syntaxErrors) {
88
- if (p.code === jsonLanguageTypes_1.ErrorCode.TrailingComma) {
89
- if (typeof trailingCommaSeverity !== 'number') {
90
- continue;
91
- }
92
- p.severity = trailingCommaSeverity;
93
- }
94
- addProblem(p);
95
- }
96
- if (typeof commentSeverity === 'number') {
97
- const message = localize('InvalidCommentToken', 'Comments are not permitted in JSON.');
98
- jsonDocument.comments.forEach(c => {
99
- addProblem(jsonLanguageTypes_1.Diagnostic.create(c, message, commentSeverity, jsonLanguageTypes_1.ErrorCode.CommentNotPermitted));
100
- });
101
- }
102
- return diagnostics;
103
- };
104
- if (schema) {
105
- const id = schema.id || ('schemaservice://untitled/' + idCounter++);
106
- const handle = this.jsonSchemaService.registerExternalSchema(id, [], schema);
107
- return handle.getResolvedSchema().then(resolvedSchema => {
108
- return getDiagnostics(resolvedSchema);
109
- });
110
- }
111
- return this.jsonSchemaService.getSchemaForResource(textDocument.uri, jsonDocument).then(schema => {
112
- return getDiagnostics(schema);
113
- });
114
- }
115
- getLanguageStatus(textDocument, jsonDocument) {
116
- return { schemas: this.jsonSchemaService.getSchemaURIsForResource(textDocument.uri, jsonDocument) };
117
- }
118
- }
119
- exports.JSONValidation = JSONValidation;
120
- let idCounter = 0;
121
- function schemaAllowsComments(schemaRef) {
122
- if (schemaRef && typeof schemaRef === 'object') {
123
- if ((0, objects_1.isBoolean)(schemaRef.allowComments)) {
124
- return schemaRef.allowComments;
125
- }
126
- if (schemaRef.allOf) {
127
- for (const schema of schemaRef.allOf) {
128
- const allow = schemaAllowsComments(schema);
129
- if ((0, objects_1.isBoolean)(allow)) {
130
- return allow;
131
- }
132
- }
133
- }
134
- }
135
- return undefined;
136
- }
137
- function schemaAllowsTrailingCommas(schemaRef) {
138
- if (schemaRef && typeof schemaRef === 'object') {
139
- if ((0, objects_1.isBoolean)(schemaRef.allowTrailingCommas)) {
140
- return schemaRef.allowTrailingCommas;
141
- }
142
- const deprSchemaRef = schemaRef;
143
- if ((0, objects_1.isBoolean)(deprSchemaRef['allowsTrailingCommas'])) { // deprecated
144
- return deprSchemaRef['allowsTrailingCommas'];
145
- }
146
- if (schemaRef.allOf) {
147
- for (const schema of schemaRef.allOf) {
148
- const allow = schemaAllowsTrailingCommas(schema);
149
- if ((0, objects_1.isBoolean)(allow)) {
150
- return allow;
151
- }
152
- }
153
- }
154
- }
155
- return undefined;
156
- }
157
- function toDiagnosticSeverity(severityLevel) {
158
- switch (severityLevel) {
159
- case 'error': return jsonLanguageTypes_1.DiagnosticSeverity.Error;
160
- case 'warning': return jsonLanguageTypes_1.DiagnosticSeverity.Warning;
161
- case 'ignore': return undefined;
162
- }
163
- return undefined;
164
- }
165
- });
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ (function (factory) {
6
+ if (typeof module === "object" && typeof module.exports === "object") {
7
+ var v = factory(require, exports);
8
+ if (v !== undefined) module.exports = v;
9
+ }
10
+ else if (typeof define === "function" && define.amd) {
11
+ define(["require", "exports", "../jsonLanguageTypes", "vscode-nls", "../utils/objects"], factory);
12
+ }
13
+ })(function (require, exports) {
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.JSONValidation = void 0;
17
+ const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
18
+ const nls = require("vscode-nls");
19
+ const objects_1 = require("../utils/objects");
20
+ const localize = nls.loadMessageBundle();
21
+ class JSONValidation {
22
+ constructor(jsonSchemaService, promiseConstructor) {
23
+ this.jsonSchemaService = jsonSchemaService;
24
+ this.promise = promiseConstructor;
25
+ this.validationEnabled = true;
26
+ }
27
+ configure(raw) {
28
+ if (raw) {
29
+ this.validationEnabled = raw.validate !== false;
30
+ this.commentSeverity = raw.allowComments ? undefined : jsonLanguageTypes_1.DiagnosticSeverity.Error;
31
+ }
32
+ }
33
+ doValidation(textDocument, jsonDocument, documentSettings, schema) {
34
+ if (!this.validationEnabled) {
35
+ return this.promise.resolve([]);
36
+ }
37
+ const diagnostics = [];
38
+ const added = {};
39
+ const addProblem = (problem) => {
40
+ // remove duplicated messages
41
+ const signature = problem.range.start.line + ' ' + problem.range.start.character + ' ' + problem.message;
42
+ if (!added[signature]) {
43
+ added[signature] = true;
44
+ diagnostics.push(problem);
45
+ }
46
+ };
47
+ const getDiagnostics = (schema) => {
48
+ let trailingCommaSeverity = documentSettings?.trailingCommas ? toDiagnosticSeverity(documentSettings.trailingCommas) : jsonLanguageTypes_1.DiagnosticSeverity.Error;
49
+ let commentSeverity = documentSettings?.comments ? toDiagnosticSeverity(documentSettings.comments) : this.commentSeverity;
50
+ let schemaValidation = documentSettings?.schemaValidation ? toDiagnosticSeverity(documentSettings.schemaValidation) : jsonLanguageTypes_1.DiagnosticSeverity.Warning;
51
+ let schemaRequest = documentSettings?.schemaRequest ? toDiagnosticSeverity(documentSettings.schemaRequest) : jsonLanguageTypes_1.DiagnosticSeverity.Warning;
52
+ if (schema) {
53
+ const addSchemaProblem = (errorMessage, errorCode) => {
54
+ if (jsonDocument.root && schemaRequest) {
55
+ const astRoot = jsonDocument.root;
56
+ const property = astRoot.type === 'object' ? astRoot.properties[0] : undefined;
57
+ if (property && property.keyNode.value === '$schema') {
58
+ const node = property.valueNode || property;
59
+ const range = jsonLanguageTypes_1.Range.create(textDocument.positionAt(node.offset), textDocument.positionAt(node.offset + node.length));
60
+ addProblem(jsonLanguageTypes_1.Diagnostic.create(range, errorMessage, schemaRequest, errorCode));
61
+ }
62
+ else {
63
+ const range = jsonLanguageTypes_1.Range.create(textDocument.positionAt(astRoot.offset), textDocument.positionAt(astRoot.offset + 1));
64
+ addProblem(jsonLanguageTypes_1.Diagnostic.create(range, errorMessage, schemaRequest, errorCode));
65
+ }
66
+ }
67
+ };
68
+ if (schema.errors.length) {
69
+ addSchemaProblem(schema.errors[0], jsonLanguageTypes_1.ErrorCode.SchemaResolveError);
70
+ }
71
+ else if (schemaValidation) {
72
+ for (const warning of schema.warnings) {
73
+ addSchemaProblem(warning, jsonLanguageTypes_1.ErrorCode.SchemaUnsupportedFeature);
74
+ }
75
+ const semanticErrors = jsonDocument.validate(textDocument, schema.schema, schemaValidation, documentSettings?.schemaDraft);
76
+ if (semanticErrors) {
77
+ semanticErrors.forEach(addProblem);
78
+ }
79
+ }
80
+ if (schemaAllowsComments(schema.schema)) {
81
+ commentSeverity = undefined;
82
+ }
83
+ if (schemaAllowsTrailingCommas(schema.schema)) {
84
+ trailingCommaSeverity = undefined;
85
+ }
86
+ }
87
+ for (const p of jsonDocument.syntaxErrors) {
88
+ if (p.code === jsonLanguageTypes_1.ErrorCode.TrailingComma) {
89
+ if (typeof trailingCommaSeverity !== 'number') {
90
+ continue;
91
+ }
92
+ p.severity = trailingCommaSeverity;
93
+ }
94
+ addProblem(p);
95
+ }
96
+ if (typeof commentSeverity === 'number') {
97
+ const message = localize('InvalidCommentToken', 'Comments are not permitted in JSON.');
98
+ jsonDocument.comments.forEach(c => {
99
+ addProblem(jsonLanguageTypes_1.Diagnostic.create(c, message, commentSeverity, jsonLanguageTypes_1.ErrorCode.CommentNotPermitted));
100
+ });
101
+ }
102
+ return diagnostics;
103
+ };
104
+ if (schema) {
105
+ const id = schema.id || ('schemaservice://untitled/' + idCounter++);
106
+ const handle = this.jsonSchemaService.registerExternalSchema(id, [], schema);
107
+ return handle.getResolvedSchema().then(resolvedSchema => {
108
+ return getDiagnostics(resolvedSchema);
109
+ });
110
+ }
111
+ return this.jsonSchemaService.getSchemaForResource(textDocument.uri, jsonDocument).then(schema => {
112
+ return getDiagnostics(schema);
113
+ });
114
+ }
115
+ getLanguageStatus(textDocument, jsonDocument) {
116
+ return { schemas: this.jsonSchemaService.getSchemaURIsForResource(textDocument.uri, jsonDocument) };
117
+ }
118
+ }
119
+ exports.JSONValidation = JSONValidation;
120
+ let idCounter = 0;
121
+ function schemaAllowsComments(schemaRef) {
122
+ if (schemaRef && typeof schemaRef === 'object') {
123
+ if ((0, objects_1.isBoolean)(schemaRef.allowComments)) {
124
+ return schemaRef.allowComments;
125
+ }
126
+ if (schemaRef.allOf) {
127
+ for (const schema of schemaRef.allOf) {
128
+ const allow = schemaAllowsComments(schema);
129
+ if ((0, objects_1.isBoolean)(allow)) {
130
+ return allow;
131
+ }
132
+ }
133
+ }
134
+ }
135
+ return undefined;
136
+ }
137
+ function schemaAllowsTrailingCommas(schemaRef) {
138
+ if (schemaRef && typeof schemaRef === 'object') {
139
+ if ((0, objects_1.isBoolean)(schemaRef.allowTrailingCommas)) {
140
+ return schemaRef.allowTrailingCommas;
141
+ }
142
+ const deprSchemaRef = schemaRef;
143
+ if ((0, objects_1.isBoolean)(deprSchemaRef['allowsTrailingCommas'])) { // deprecated
144
+ return deprSchemaRef['allowsTrailingCommas'];
145
+ }
146
+ if (schemaRef.allOf) {
147
+ for (const schema of schemaRef.allOf) {
148
+ const allow = schemaAllowsTrailingCommas(schema);
149
+ if ((0, objects_1.isBoolean)(allow)) {
150
+ return allow;
151
+ }
152
+ }
153
+ }
154
+ }
155
+ return undefined;
156
+ }
157
+ function toDiagnosticSeverity(severityLevel) {
158
+ switch (severityLevel) {
159
+ case 'error': return jsonLanguageTypes_1.DiagnosticSeverity.Error;
160
+ case 'warning': return jsonLanguageTypes_1.DiagnosticSeverity.Warning;
161
+ case 'ignore': return undefined;
162
+ }
163
+ return undefined;
164
+ }
165
+ });