vscode-json-languageservice 3.4.12 → 3.7.0
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.
- package/.nyc_output/0abe3076-16a9-4975-87da-4ecfc24d9226.json +1 -0
- package/.nyc_output/5a0d1463-368f-4136-8a80-4c7fda7ca33b.json +1 -0
- package/.nyc_output/65e3530f-ee58-4bcb-8484-70eb1822427e.json +1 -0
- package/.nyc_output/a37c9066-0aa4-4d91-a56b-17754005a42d.json +1 -0
- package/.nyc_output/b7eb272f-3bf3-48c4-9a42-90600332b363.json +1 -0
- package/.nyc_output/cabc6994-64f7-4258-bb45-9bb5529b388e.json +1 -0
- package/.nyc_output/processinfo/0abe3076-16a9-4975-87da-4ecfc24d9226.json +1 -0
- package/.nyc_output/processinfo/5a0d1463-368f-4136-8a80-4c7fda7ca33b.json +1 -0
- package/.nyc_output/processinfo/65e3530f-ee58-4bcb-8484-70eb1822427e.json +1 -0
- package/.nyc_output/processinfo/a37c9066-0aa4-4d91-a56b-17754005a42d.json +1 -0
- package/.nyc_output/processinfo/b7eb272f-3bf3-48c4-9a42-90600332b363.json +1 -0
- package/.nyc_output/processinfo/cabc6994-64f7-4258-bb45-9bb5529b388e.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/CHANGELOG.md +13 -1
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +156 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov-report/src/index.html +126 -0
- package/coverage/lcov-report/src/jsonLanguageService.ts.html +383 -0
- package/coverage/lcov-report/src/jsonLanguageTypes.ts.html +968 -0
- package/coverage/lcov-report/src/parser/index.html +111 -0
- package/coverage/lcov-report/src/parser/jsonParser.ts.html +3860 -0
- package/coverage/lcov-report/src/services/configuration.ts.html +1679 -0
- package/coverage/lcov-report/src/services/index.html +216 -0
- package/coverage/lcov-report/src/services/jsonCompletion.ts.html +2843 -0
- package/coverage/lcov-report/src/services/jsonDocumentSymbols.ts.html +911 -0
- package/coverage/lcov-report/src/services/jsonFolding.ts.html +455 -0
- package/coverage/lcov-report/src/services/jsonHover.ts.html +461 -0
- package/coverage/lcov-report/src/services/jsonSchemaService.ts.html +1895 -0
- package/coverage/lcov-report/src/services/jsonSelectionRanges.ts.html +311 -0
- package/coverage/lcov-report/src/services/jsonValidation.ts.html +560 -0
- package/coverage/lcov-report/src/utils/colors.ts.html +299 -0
- package/coverage/lcov-report/src/utils/index.html +156 -0
- package/coverage/lcov-report/src/utils/json.ts.html +206 -0
- package/coverage/lcov-report/src/utils/objects.ts.html +296 -0
- package/coverage/lcov-report/src/utils/strings.ts.html +224 -0
- package/coverage/lcov.info +4219 -0
- package/lib/esm/jsonLanguageService.d.ts +2 -1
- package/lib/esm/jsonLanguageService.js +3 -1
- package/lib/esm/jsonLanguageTypes.d.ts +4 -2
- package/lib/esm/jsonSchema.d.ts +1 -0
- package/lib/esm/parser/jsonParser.js +31 -30
- package/lib/esm/services/configuration.js +2 -2
- package/lib/esm/services/jsonCompletion.js +39 -33
- package/lib/esm/services/jsonDefinition.js +83 -0
- package/lib/esm/services/jsonDocumentSymbols.js +4 -4
- package/lib/esm/services/jsonHover.js +5 -5
- package/lib/esm/services/jsonSchemaService.js +90 -79
- package/lib/esm/services/jsonValidation.js +9 -8
- package/lib/esm/utils/colors.js +2 -2
- package/lib/umd/jsonLanguageService.d.ts +2 -1
- package/lib/umd/jsonLanguageService.js +4 -2
- package/lib/umd/jsonLanguageTypes.d.ts +4 -2
- package/lib/umd/jsonSchema.d.ts +1 -0
- package/lib/umd/parser/jsonParser.js +31 -30
- package/lib/umd/services/configuration.js +2 -2
- package/lib/umd/services/jsonCompletion.js +39 -33
- package/lib/umd/services/jsonDefinition.js +96 -0
- package/lib/umd/services/jsonDocumentSymbols.js +4 -4
- package/lib/umd/services/jsonHover.js +5 -5
- package/lib/umd/services/jsonSchemaService.js +90 -79
- package/lib/umd/services/jsonValidation.js +9 -8
- package/lib/umd/utils/colors.js +2 -2
- package/package.json +19 -13
|
@@ -20,24 +20,40 @@
|
|
|
20
20
|
var nls = require("vscode-nls");
|
|
21
21
|
var localize = nls.loadMessageBundle();
|
|
22
22
|
var FilePatternAssociation = /** @class */ (function () {
|
|
23
|
-
function FilePatternAssociation(pattern) {
|
|
23
|
+
function FilePatternAssociation(pattern, uris) {
|
|
24
|
+
this.patternRegExps = [];
|
|
25
|
+
this.isInclude = [];
|
|
24
26
|
try {
|
|
25
|
-
|
|
27
|
+
for (var _i = 0, pattern_1 = pattern; _i < pattern_1.length; _i++) {
|
|
28
|
+
var p = pattern_1[_i];
|
|
29
|
+
var include = p[0] !== '!';
|
|
30
|
+
if (!include) {
|
|
31
|
+
p = p.substring(1);
|
|
32
|
+
}
|
|
33
|
+
this.patternRegExps.push(new RegExp(Strings.convertSimple2RegExpPattern(p) + '$'));
|
|
34
|
+
this.isInclude.push(include);
|
|
35
|
+
}
|
|
36
|
+
this.uris = uris;
|
|
26
37
|
}
|
|
27
38
|
catch (e) {
|
|
28
39
|
// invalid pattern
|
|
29
|
-
this.
|
|
40
|
+
this.patternRegExps.length = 0;
|
|
41
|
+
this.isInclude.length = 0;
|
|
42
|
+
this.uris = [];
|
|
30
43
|
}
|
|
31
|
-
this.schemas = [];
|
|
32
44
|
}
|
|
33
|
-
FilePatternAssociation.prototype.addSchema = function (id) {
|
|
34
|
-
this.schemas.push(id);
|
|
35
|
-
};
|
|
36
45
|
FilePatternAssociation.prototype.matchesPattern = function (fileName) {
|
|
37
|
-
|
|
46
|
+
var match = false;
|
|
47
|
+
for (var i = 0; i < this.patternRegExps.length; i++) {
|
|
48
|
+
var regExp = this.patternRegExps[i];
|
|
49
|
+
if (regExp.test(fileName)) {
|
|
50
|
+
match = this.isInclude[i];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return match;
|
|
38
54
|
};
|
|
39
|
-
FilePatternAssociation.prototype.
|
|
40
|
-
return this.
|
|
55
|
+
FilePatternAssociation.prototype.getURIs = function () {
|
|
56
|
+
return this.uris;
|
|
41
57
|
};
|
|
42
58
|
return FilePatternAssociation;
|
|
43
59
|
}());
|
|
@@ -66,8 +82,8 @@
|
|
|
66
82
|
return this.resolvedSchema;
|
|
67
83
|
};
|
|
68
84
|
SchemaHandle.prototype.clearSchema = function () {
|
|
69
|
-
this.resolvedSchema =
|
|
70
|
-
this.unresolvedSchema =
|
|
85
|
+
this.resolvedSchema = undefined;
|
|
86
|
+
this.unresolvedSchema = undefined;
|
|
71
87
|
this.dependencies = {};
|
|
72
88
|
};
|
|
73
89
|
return SchemaHandle;
|
|
@@ -88,7 +104,11 @@
|
|
|
88
104
|
this.errors = errors;
|
|
89
105
|
}
|
|
90
106
|
ResolvedSchema.prototype.getSection = function (path) {
|
|
91
|
-
|
|
107
|
+
var schemaRef = this.getSectionRecursive(path, this.schema);
|
|
108
|
+
if (schemaRef) {
|
|
109
|
+
return Parser.asSchema(schemaRef);
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
92
112
|
};
|
|
93
113
|
ResolvedSchema.prototype.getSectionRecursive = function (path, schema) {
|
|
94
114
|
if (!schema || typeof schema === 'boolean' || path.length === 0) {
|
|
@@ -121,7 +141,7 @@
|
|
|
121
141
|
return this.getSectionRecursive(path, schema.items);
|
|
122
142
|
}
|
|
123
143
|
}
|
|
124
|
-
return
|
|
144
|
+
return undefined;
|
|
125
145
|
};
|
|
126
146
|
return ResolvedSchema;
|
|
127
147
|
}());
|
|
@@ -133,10 +153,9 @@
|
|
|
133
153
|
this.promiseConstructor = promiseConstructor || Promise;
|
|
134
154
|
this.callOnDispose = [];
|
|
135
155
|
this.contributionSchemas = {};
|
|
136
|
-
this.contributionAssociations =
|
|
156
|
+
this.contributionAssociations = [];
|
|
137
157
|
this.schemasById = {};
|
|
138
158
|
this.filePatternAssociations = [];
|
|
139
|
-
this.filePatternAssociationById = {};
|
|
140
159
|
this.registeredSchemasIds = {};
|
|
141
160
|
}
|
|
142
161
|
JSONSchemaService.prototype.getRegisteredSchemaIds = function (filter) {
|
|
@@ -160,7 +179,7 @@
|
|
|
160
179
|
JSONSchemaService.prototype.onResourceChange = function (uri) {
|
|
161
180
|
var _this = this;
|
|
162
181
|
var hasChanges = false;
|
|
163
|
-
uri =
|
|
182
|
+
uri = normalizeId(uri);
|
|
164
183
|
var toWalk = [uri];
|
|
165
184
|
var all = Object.keys(this.schemasById).map(function (key) { return _this.schemasById[key]; });
|
|
166
185
|
while (toWalk.length) {
|
|
@@ -179,34 +198,21 @@
|
|
|
179
198
|
}
|
|
180
199
|
return hasChanges;
|
|
181
200
|
};
|
|
182
|
-
JSONSchemaService.prototype.normalizeId = function (id) {
|
|
183
|
-
// remove trailing '#', normalize drive capitalization
|
|
184
|
-
try {
|
|
185
|
-
return vscode_uri_1.URI.parse(id).toString();
|
|
186
|
-
}
|
|
187
|
-
catch (e) {
|
|
188
|
-
return id;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
201
|
JSONSchemaService.prototype.setSchemaContributions = function (schemaContributions) {
|
|
192
202
|
if (schemaContributions.schemas) {
|
|
193
203
|
var schemas = schemaContributions.schemas;
|
|
194
204
|
for (var id in schemas) {
|
|
195
|
-
var normalizedId =
|
|
205
|
+
var normalizedId = normalizeId(id);
|
|
196
206
|
this.contributionSchemas[normalizedId] = this.addSchemaHandle(normalizedId, schemas[id]);
|
|
197
207
|
}
|
|
198
208
|
}
|
|
199
|
-
if (schemaContributions.schemaAssociations) {
|
|
209
|
+
if (Array.isArray(schemaContributions.schemaAssociations)) {
|
|
200
210
|
var schemaAssociations = schemaContributions.schemaAssociations;
|
|
201
|
-
for (var
|
|
202
|
-
var
|
|
203
|
-
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
var schemaId = associations_1[_i];
|
|
207
|
-
var id = this.normalizeId(schemaId);
|
|
208
|
-
fpa.addSchema(id);
|
|
209
|
-
}
|
|
211
|
+
for (var _i = 0, schemaAssociations_1 = schemaAssociations; _i < schemaAssociations_1.length; _i++) {
|
|
212
|
+
var schemaAssociation = schemaAssociations_1[_i];
|
|
213
|
+
var uris = schemaAssociation.uris.map(normalizeId);
|
|
214
|
+
var association = this.addFilePatternAssociation(schemaAssociation.pattern, uris);
|
|
215
|
+
this.contributionAssociations.push(association);
|
|
210
216
|
}
|
|
211
217
|
}
|
|
212
218
|
};
|
|
@@ -218,52 +224,41 @@
|
|
|
218
224
|
JSONSchemaService.prototype.getOrAddSchemaHandle = function (id, unresolvedSchemaContent) {
|
|
219
225
|
return this.schemasById[id] || this.addSchemaHandle(id, unresolvedSchemaContent);
|
|
220
226
|
};
|
|
221
|
-
JSONSchemaService.prototype.
|
|
222
|
-
var fpa =
|
|
223
|
-
|
|
224
|
-
fpa = new FilePatternAssociation(pattern);
|
|
225
|
-
this.filePatternAssociationById[pattern] = fpa;
|
|
226
|
-
this.filePatternAssociations.push(fpa);
|
|
227
|
-
}
|
|
227
|
+
JSONSchemaService.prototype.addFilePatternAssociation = function (pattern, uris) {
|
|
228
|
+
var fpa = new FilePatternAssociation(pattern, uris);
|
|
229
|
+
this.filePatternAssociations.push(fpa);
|
|
228
230
|
return fpa;
|
|
229
231
|
};
|
|
230
232
|
JSONSchemaService.prototype.registerExternalSchema = function (uri, filePatterns, unresolvedSchemaContent) {
|
|
231
|
-
|
|
232
|
-
var id = this.normalizeId(uri);
|
|
233
|
+
var id = normalizeId(uri);
|
|
233
234
|
this.registeredSchemasIds[id] = true;
|
|
235
|
+
this.cachedSchemaForResource = undefined;
|
|
234
236
|
if (filePatterns) {
|
|
235
|
-
|
|
236
|
-
var pattern = filePatterns_1[_i];
|
|
237
|
-
this.getOrAddFilePatternAssociation(pattern).addSchema(id);
|
|
238
|
-
}
|
|
237
|
+
this.addFilePatternAssociation(filePatterns, [uri]);
|
|
239
238
|
}
|
|
240
239
|
return unresolvedSchemaContent ? this.addSchemaHandle(id, unresolvedSchemaContent) : this.getOrAddSchemaHandle(id);
|
|
241
240
|
};
|
|
242
241
|
JSONSchemaService.prototype.clearExternalSchemas = function () {
|
|
243
242
|
this.schemasById = {};
|
|
244
243
|
this.filePatternAssociations = [];
|
|
245
|
-
this.filePatternAssociationById = {};
|
|
246
244
|
this.registeredSchemasIds = {};
|
|
245
|
+
this.cachedSchemaForResource = undefined;
|
|
247
246
|
for (var id in this.contributionSchemas) {
|
|
248
247
|
this.schemasById[id] = this.contributionSchemas[id];
|
|
249
248
|
this.registeredSchemasIds[id] = true;
|
|
250
249
|
}
|
|
251
|
-
for (var
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
var schemaId = _a[_i];
|
|
255
|
-
var id = this.normalizeId(schemaId);
|
|
256
|
-
fpa.addSchema(id);
|
|
257
|
-
}
|
|
250
|
+
for (var _i = 0, _a = this.contributionAssociations; _i < _a.length; _i++) {
|
|
251
|
+
var contributionAssociation = _a[_i];
|
|
252
|
+
this.filePatternAssociations.push(contributionAssociation);
|
|
258
253
|
}
|
|
259
254
|
};
|
|
260
255
|
JSONSchemaService.prototype.getResolvedSchema = function (schemaId) {
|
|
261
|
-
var id =
|
|
256
|
+
var id = normalizeId(schemaId);
|
|
262
257
|
var schemaHandle = this.schemasById[id];
|
|
263
258
|
if (schemaHandle) {
|
|
264
259
|
return schemaHandle.getResolvedSchema();
|
|
265
260
|
}
|
|
266
|
-
return this.promise.resolve(
|
|
261
|
+
return this.promise.resolve(undefined);
|
|
267
262
|
};
|
|
268
263
|
JSONSchemaService.prototype.loadSchema = function (url) {
|
|
269
264
|
if (!this.requestService) {
|
|
@@ -298,7 +293,7 @@
|
|
|
298
293
|
var resolveErrors = schemaToResolve.errors.slice(0);
|
|
299
294
|
var schema = schemaToResolve.schema;
|
|
300
295
|
if (schema.$schema) {
|
|
301
|
-
var id =
|
|
296
|
+
var id = normalizeId(schema.$schema);
|
|
302
297
|
if (id === 'http://json-schema.org/draft-03/schema') {
|
|
303
298
|
return this.promise.resolve(new ResolvedSchema({}, [localize('json.schema.draft03.notsupported', "Draft-03 schemas are not supported.")]));
|
|
304
299
|
}
|
|
@@ -321,7 +316,8 @@
|
|
|
321
316
|
});
|
|
322
317
|
return current;
|
|
323
318
|
};
|
|
324
|
-
var merge = function (target, sourceRoot, sourceURI,
|
|
319
|
+
var merge = function (target, sourceRoot, sourceURI, refSegment) {
|
|
320
|
+
var path = refSegment ? decodeURIComponent(refSegment) : undefined;
|
|
325
321
|
var section = findSection(sourceRoot, path);
|
|
326
322
|
if (section) {
|
|
327
323
|
for (var key in section) {
|
|
@@ -334,19 +330,19 @@
|
|
|
334
330
|
resolveErrors.push(localize('json.schema.invalidref', '$ref \'{0}\' in \'{1}\' can not be resolved.', path, sourceURI));
|
|
335
331
|
}
|
|
336
332
|
};
|
|
337
|
-
var resolveExternalLink = function (node, uri,
|
|
333
|
+
var resolveExternalLink = function (node, uri, refSegment, parentSchemaURL, parentSchemaDependencies) {
|
|
338
334
|
if (contextService && !/^\w+:\/\/.*/.test(uri)) {
|
|
339
335
|
uri = contextService.resolveRelativePath(uri, parentSchemaURL);
|
|
340
336
|
}
|
|
341
|
-
uri =
|
|
337
|
+
uri = normalizeId(uri);
|
|
342
338
|
var referencedHandle = _this.getOrAddSchemaHandle(uri);
|
|
343
339
|
return referencedHandle.getUnresolvedSchema().then(function (unresolvedSchema) {
|
|
344
340
|
parentSchemaDependencies[uri] = true;
|
|
345
341
|
if (unresolvedSchema.errors.length) {
|
|
346
|
-
var loc =
|
|
342
|
+
var loc = refSegment ? uri + '#' + refSegment : uri;
|
|
347
343
|
resolveErrors.push(localize('json.schema.problemloadingref', 'Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0]));
|
|
348
344
|
}
|
|
349
|
-
merge(node, unresolvedSchema.schema, uri,
|
|
345
|
+
merge(node, unresolvedSchema.schema, uri, refSegment);
|
|
350
346
|
return resolveRefs(node, unresolvedSchema.schema, uri, referencedHandle.dependencies);
|
|
351
347
|
});
|
|
352
348
|
};
|
|
@@ -377,7 +373,8 @@
|
|
|
377
373
|
for (var _a = 0, maps_1 = maps; _a < maps_1.length; _a++) {
|
|
378
374
|
var map = maps_1[_a];
|
|
379
375
|
if (typeof map === 'object') {
|
|
380
|
-
for (var
|
|
376
|
+
for (var k in map) {
|
|
377
|
+
var key = k;
|
|
381
378
|
var entry = map[key];
|
|
382
379
|
if (typeof entry === 'object') {
|
|
383
380
|
toWalk.push(entry);
|
|
@@ -441,22 +438,28 @@
|
|
|
441
438
|
if (document && document.root && document.root.type === 'object') {
|
|
442
439
|
var schemaProperties = document.root.properties.filter(function (p) { return (p.keyNode.value === '$schema') && p.valueNode && p.valueNode.type === 'string'; });
|
|
443
440
|
if (schemaProperties.length > 0) {
|
|
444
|
-
var
|
|
445
|
-
if (
|
|
446
|
-
schemeId =
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
441
|
+
var valueNode = schemaProperties[0].valueNode;
|
|
442
|
+
if (valueNode && valueNode.type === 'string') {
|
|
443
|
+
var schemeId = Parser.getNodeValue(valueNode);
|
|
444
|
+
if (schemeId && Strings.startsWith(schemeId, '.') && this.contextService) {
|
|
445
|
+
schemeId = this.contextService.resolveRelativePath(schemeId, resource);
|
|
446
|
+
}
|
|
447
|
+
if (schemeId) {
|
|
448
|
+
var id = normalizeId(schemeId);
|
|
449
|
+
return this.getOrAddSchemaHandle(id).getResolvedSchema();
|
|
450
|
+
}
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
+
if (this.cachedSchemaForResource && this.cachedSchemaForResource.resource === resource) {
|
|
455
|
+
return this.cachedSchemaForResource.resolvedSchema;
|
|
456
|
+
}
|
|
454
457
|
var seen = Object.create(null);
|
|
455
458
|
var schemas = [];
|
|
456
459
|
for (var _i = 0, _a = this.filePatternAssociations; _i < _a.length; _i++) {
|
|
457
460
|
var entry = _a[_i];
|
|
458
461
|
if (entry.matchesPattern(resource)) {
|
|
459
|
-
for (var _b = 0, _c = entry.
|
|
462
|
+
for (var _b = 0, _c = entry.getURIs(); _b < _c.length; _b++) {
|
|
460
463
|
var schemaId = _c[_b];
|
|
461
464
|
if (!seen[schemaId]) {
|
|
462
465
|
schemas.push(schemaId);
|
|
@@ -465,10 +468,9 @@
|
|
|
465
468
|
}
|
|
466
469
|
}
|
|
467
470
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
return this.promise.resolve(null);
|
|
471
|
+
var resolvedSchema = schemas.length > 0 ? this.createCombinedSchema(resource, schemas).getResolvedSchema() : this.promise.resolve(undefined);
|
|
472
|
+
this.cachedSchemaForResource = { resource: resource, resolvedSchema: resolvedSchema };
|
|
473
|
+
return resolvedSchema;
|
|
472
474
|
};
|
|
473
475
|
JSONSchemaService.prototype.createCombinedSchema = function (resource, schemaIds) {
|
|
474
476
|
if (schemaIds.length === 1) {
|
|
@@ -485,6 +487,15 @@
|
|
|
485
487
|
return JSONSchemaService;
|
|
486
488
|
}());
|
|
487
489
|
exports.JSONSchemaService = JSONSchemaService;
|
|
490
|
+
function normalizeId(id) {
|
|
491
|
+
// remove trailing '#', normalize drive capitalization
|
|
492
|
+
try {
|
|
493
|
+
return vscode_uri_1.URI.parse(id).toString();
|
|
494
|
+
}
|
|
495
|
+
catch (e) {
|
|
496
|
+
return id;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
488
499
|
function toDisplayString(url) {
|
|
489
500
|
try {
|
|
490
501
|
var uri = vscode_uri_1.URI.parse(url);
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
JSONValidation.prototype.configure = function (raw) {
|
|
28
28
|
if (raw) {
|
|
29
29
|
this.validationEnabled = raw.validate;
|
|
30
|
-
this.commentSeverity = raw.allowComments ?
|
|
30
|
+
this.commentSeverity = raw.allowComments ? undefined : jsonLanguageTypes_1.DiagnosticSeverity.Error;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
JSONValidation.prototype.doValidation = function (textDocument, jsonDocument, documentSettings, schema) {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
if (schema) {
|
|
52
52
|
if (schema.errors.length && jsonDocument.root) {
|
|
53
53
|
var astRoot = jsonDocument.root;
|
|
54
|
-
var property = astRoot.type === 'object' ? astRoot.properties[0] :
|
|
54
|
+
var property = astRoot.type === 'object' ? astRoot.properties[0] : undefined;
|
|
55
55
|
if (property && property.keyNode.value === '$schema') {
|
|
56
56
|
var node = property.valueNode || property;
|
|
57
57
|
var range = jsonLanguageTypes_1.Range.create(textDocument.positionAt(node.offset), textDocument.positionAt(node.offset + node.length));
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
if (schemaAllowsComments(schema.schema)) {
|
|
72
|
-
commentSeverity =
|
|
72
|
+
commentSeverity = undefined;
|
|
73
73
|
}
|
|
74
74
|
if (schemaAllowsTrailingCommas(schema.schema)) {
|
|
75
|
-
trailingCommaSeverity =
|
|
75
|
+
trailingCommaSeverity = undefined;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
for (var _i = 0, _a = jsonDocument.syntaxErrors; _i < _a.length; _i++) {
|
|
@@ -129,8 +129,9 @@
|
|
|
129
129
|
if (objects_1.isBoolean(schemaRef.allowTrailingCommas)) {
|
|
130
130
|
return schemaRef.allowTrailingCommas;
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
var deprSchemaRef = schemaRef;
|
|
133
|
+
if (objects_1.isBoolean(deprSchemaRef['allowsTrailingCommas'])) { // deprecated
|
|
134
|
+
return deprSchemaRef['allowsTrailingCommas'];
|
|
134
135
|
}
|
|
135
136
|
if (schemaRef.allOf) {
|
|
136
137
|
for (var _i = 0, _a = schemaRef.allOf; _i < _a.length; _i++) {
|
|
@@ -148,8 +149,8 @@
|
|
|
148
149
|
switch (severityLevel) {
|
|
149
150
|
case 'error': return jsonLanguageTypes_1.DiagnosticSeverity.Error;
|
|
150
151
|
case 'warning': return jsonLanguageTypes_1.DiagnosticSeverity.Warning;
|
|
151
|
-
case 'ignore': return
|
|
152
|
+
case 'ignore': return undefined;
|
|
152
153
|
}
|
|
153
|
-
return
|
|
154
|
+
return undefined;
|
|
154
155
|
}
|
|
155
156
|
});
|
package/lib/umd/utils/colors.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
exports.hexDigit = hexDigit;
|
|
37
37
|
function colorFromHex(text) {
|
|
38
38
|
if (text[0] !== '#') {
|
|
39
|
-
return
|
|
39
|
+
return undefined;
|
|
40
40
|
}
|
|
41
41
|
switch (text.length) {
|
|
42
42
|
case 4:
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
alpha: (hexDigit(text.charCodeAt(7)) * 0x10 + hexDigit(text.charCodeAt(8))) / 255.0
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
return
|
|
71
|
+
return undefined;
|
|
72
72
|
}
|
|
73
73
|
exports.colorFromHex = colorFromHex;
|
|
74
74
|
function colorFrom256RGB(red, green, blue, alpha) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-json-languageservice",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Language service for JSON",
|
|
5
5
|
"main": "./lib/umd/jsonLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/jsonLanguageService",
|
|
@@ -15,19 +15,22 @@
|
|
|
15
15
|
"url": "https://github.com/Microsoft/vscode-json-languageservice"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/mocha": "^
|
|
18
|
+
"@types/mocha": "^7.0.2",
|
|
19
19
|
"@types/node": "^10.12.21",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^3.1.0",
|
|
21
|
+
"@typescript-eslint/parser": "^3.1.0",
|
|
22
|
+
"eslint": "^7.1.0",
|
|
23
|
+
"mocha": "^7.2.0",
|
|
24
|
+
"nyc": "^15.0.1",
|
|
25
|
+
"rimraf": "^3.0.2",
|
|
26
|
+
"typescript": "^3.8.3"
|
|
24
27
|
},
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"jsonc-parser": "^2.2.
|
|
27
|
-
"vscode-languageserver-textdocument": "^1.0.1
|
|
28
|
-
"vscode-languageserver-types": "^3.15.
|
|
29
|
-
"vscode-nls": "^4.1.
|
|
30
|
-
"vscode-uri": "^2.1.
|
|
29
|
+
"jsonc-parser": "^2.2.1",
|
|
30
|
+
"vscode-languageserver-textdocument": "^1.0.1",
|
|
31
|
+
"vscode-languageserver-types": "^3.15.1",
|
|
32
|
+
"vscode-nls": "^4.1.2",
|
|
33
|
+
"vscode-uri": "^2.1.2"
|
|
31
34
|
},
|
|
32
35
|
"scripts": {
|
|
33
36
|
"prepublishOnly": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
|
|
@@ -37,8 +40,11 @@
|
|
|
37
40
|
"clean": "rimraf lib",
|
|
38
41
|
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js",
|
|
39
42
|
"watch": "tsc -w -p ./src",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
43
|
+
"pretest": "npm run compile",
|
|
44
|
+
"test": "mocha",
|
|
45
|
+
"posttest": "npm run lint",
|
|
46
|
+
"coverage": "nyc -r lcov npm run test",
|
|
47
|
+
"lint": "eslint src/**/*.ts",
|
|
42
48
|
"install-types-next": "npm install vscode-languageserver-types@next -f -S && npm install vscode-languageserver-textdocument@next -f -S",
|
|
43
49
|
"preversion": "npm test",
|
|
44
50
|
"postversion": "git push && git push --tags"
|