vscode-json-languageservice 3.7.0 → 3.8.3
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/CHANGELOG.md +12 -8
- package/README.md +2 -1
- package/lib/esm/jsonLanguageService.d.ts +6 -2
- package/lib/esm/jsonLanguageService.js +1 -0
- package/lib/esm/jsonLanguageTypes.d.ts +7 -4
- package/lib/esm/jsonLanguageTypes.js +7 -3
- package/lib/esm/parser/jsonParser.js +33 -6
- package/lib/esm/services/jsonCompletion.js +61 -3
- package/lib/esm/services/jsonSchemaService.js +18 -3
- package/lib/umd/jsonLanguageService.d.ts +6 -2
- package/lib/umd/jsonLanguageService.js +13 -4
- package/lib/umd/jsonLanguageTypes.d.ts +7 -4
- package/lib/umd/jsonLanguageTypes.js +31 -6
- package/lib/umd/parser/jsonParser.js +34 -6
- package/lib/umd/services/configuration.js +1 -0
- package/lib/umd/services/jsonCompletion.js +62 -3
- package/lib/umd/services/jsonDefinition.js +1 -0
- package/lib/umd/services/jsonDocumentSymbols.js +1 -0
- package/lib/umd/services/jsonFolding.js +1 -0
- package/lib/umd/services/jsonHover.js +1 -0
- package/lib/umd/services/jsonSchemaService.js +19 -3
- package/lib/umd/services/jsonSelectionRanges.js +1 -0
- package/lib/umd/services/jsonValidation.js +1 -0
- package/lib/umd/utils/colors.js +1 -0
- package/lib/umd/utils/json.js +1 -0
- package/lib/umd/utils/objects.js +1 -0
- package/lib/umd/utils/strings.js +1 -0
- package/package.json +1 -1
- package/.nyc_output/0abe3076-16a9-4975-87da-4ecfc24d9226.json +0 -1
- package/.nyc_output/5a0d1463-368f-4136-8a80-4c7fda7ca33b.json +0 -1
- package/.nyc_output/65e3530f-ee58-4bcb-8484-70eb1822427e.json +0 -1
- package/.nyc_output/a37c9066-0aa4-4d91-a56b-17754005a42d.json +0 -1
- package/.nyc_output/b7eb272f-3bf3-48c4-9a42-90600332b363.json +0 -1
- package/.nyc_output/cabc6994-64f7-4258-bb45-9bb5529b388e.json +0 -1
- package/.nyc_output/processinfo/0abe3076-16a9-4975-87da-4ecfc24d9226.json +0 -1
- package/.nyc_output/processinfo/5a0d1463-368f-4136-8a80-4c7fda7ca33b.json +0 -1
- package/.nyc_output/processinfo/65e3530f-ee58-4bcb-8484-70eb1822427e.json +0 -1
- package/.nyc_output/processinfo/a37c9066-0aa4-4d91-a56b-17754005a42d.json +0 -1
- package/.nyc_output/processinfo/b7eb272f-3bf3-48c4-9a42-90600332b363.json +0 -1
- package/.nyc_output/processinfo/cabc6994-64f7-4258-bb45-9bb5529b388e.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -156
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov-report/src/index.html +0 -126
- package/coverage/lcov-report/src/jsonLanguageService.ts.html +0 -383
- package/coverage/lcov-report/src/jsonLanguageTypes.ts.html +0 -968
- package/coverage/lcov-report/src/parser/index.html +0 -111
- package/coverage/lcov-report/src/parser/jsonParser.ts.html +0 -3860
- package/coverage/lcov-report/src/services/configuration.ts.html +0 -1679
- package/coverage/lcov-report/src/services/index.html +0 -216
- package/coverage/lcov-report/src/services/jsonCompletion.ts.html +0 -2843
- package/coverage/lcov-report/src/services/jsonDocumentSymbols.ts.html +0 -911
- package/coverage/lcov-report/src/services/jsonFolding.ts.html +0 -455
- package/coverage/lcov-report/src/services/jsonHover.ts.html +0 -461
- package/coverage/lcov-report/src/services/jsonSchemaService.ts.html +0 -1895
- package/coverage/lcov-report/src/services/jsonSelectionRanges.ts.html +0 -311
- package/coverage/lcov-report/src/services/jsonValidation.ts.html +0 -560
- package/coverage/lcov-report/src/utils/colors.ts.html +0 -299
- package/coverage/lcov-report/src/utils/index.html +0 -156
- package/coverage/lcov-report/src/utils/json.ts.html +0 -206
- package/coverage/lcov-report/src/utils/objects.ts.html +0 -296
- package/coverage/lcov-report/src/utils/strings.ts.html +0 -224
- package/coverage/lcov.info +0 -4219
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.JSONCompletion = void 0;
|
|
16
17
|
var Parser = require("../parser/jsonParser");
|
|
17
18
|
var Json = require("jsonc-parser");
|
|
18
19
|
var json_1 = require("../utils/json");
|
|
@@ -234,6 +235,45 @@
|
|
|
234
235
|
}
|
|
235
236
|
});
|
|
236
237
|
}
|
|
238
|
+
var schemaPropertyNames_1 = s.schema.propertyNames;
|
|
239
|
+
if (typeof schemaPropertyNames_1 === 'object' && !schemaPropertyNames_1.deprecationMessage && !schemaPropertyNames_1.doNotSuggest) {
|
|
240
|
+
var propertyNameCompletionItem = function (name, enumDescription) {
|
|
241
|
+
if (enumDescription === void 0) { enumDescription = undefined; }
|
|
242
|
+
var proposal = {
|
|
243
|
+
kind: jsonLanguageTypes_1.CompletionItemKind.Property,
|
|
244
|
+
label: name,
|
|
245
|
+
insertText: _this.getInsertTextForProperty(name, undefined, addValue, separatorAfter),
|
|
246
|
+
insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet,
|
|
247
|
+
filterText: _this.getFilterTextForValue(name),
|
|
248
|
+
documentation: enumDescription || _this.fromMarkup(schemaPropertyNames_1.markdownDescription) || schemaPropertyNames_1.description || '',
|
|
249
|
+
};
|
|
250
|
+
if (schemaPropertyNames_1.suggestSortText !== undefined) {
|
|
251
|
+
proposal.sortText = schemaPropertyNames_1.suggestSortText;
|
|
252
|
+
}
|
|
253
|
+
if (proposal.insertText && strings_1.endsWith(proposal.insertText, "$1" + separatorAfter)) {
|
|
254
|
+
proposal.command = {
|
|
255
|
+
title: 'Suggest',
|
|
256
|
+
command: 'editor.action.triggerSuggest'
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
collector.add(proposal);
|
|
260
|
+
};
|
|
261
|
+
if (schemaPropertyNames_1.enum) {
|
|
262
|
+
for (var i = 0; i < schemaPropertyNames_1.enum.length; i++) {
|
|
263
|
+
var enumDescription = undefined;
|
|
264
|
+
if (schemaPropertyNames_1.markdownEnumDescriptions && i < schemaPropertyNames_1.markdownEnumDescriptions.length) {
|
|
265
|
+
enumDescription = _this.fromMarkup(schemaPropertyNames_1.markdownEnumDescriptions[i]);
|
|
266
|
+
}
|
|
267
|
+
else if (schemaPropertyNames_1.enumDescriptions && i < schemaPropertyNames_1.enumDescriptions.length) {
|
|
268
|
+
enumDescription = schemaPropertyNames_1.enumDescriptions[i];
|
|
269
|
+
}
|
|
270
|
+
propertyNameCompletionItem(schemaPropertyNames_1.enum[i], enumDescription);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (schemaPropertyNames_1.const) {
|
|
274
|
+
propertyNameCompletionItem(schemaPropertyNames_1.const);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
237
277
|
}
|
|
238
278
|
});
|
|
239
279
|
};
|
|
@@ -394,9 +434,28 @@
|
|
|
394
434
|
this.addSchemaValueCompletions(s.schema.items, separatorAfter, collector, types);
|
|
395
435
|
}
|
|
396
436
|
}
|
|
397
|
-
if (
|
|
398
|
-
var
|
|
399
|
-
if (
|
|
437
|
+
if (parentKey !== undefined) {
|
|
438
|
+
var propertyMatched = false;
|
|
439
|
+
if (s.schema.properties) {
|
|
440
|
+
var propertySchema = s.schema.properties[parentKey];
|
|
441
|
+
if (propertySchema) {
|
|
442
|
+
propertyMatched = true;
|
|
443
|
+
this.addSchemaValueCompletions(propertySchema, separatorAfter, collector, types);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (s.schema.patternProperties && !propertyMatched) {
|
|
447
|
+
for (var _a = 0, _b = Object.keys(s.schema.patternProperties); _a < _b.length; _a++) {
|
|
448
|
+
var pattern = _b[_a];
|
|
449
|
+
var regex = new RegExp(pattern);
|
|
450
|
+
if (regex.test(parentKey)) {
|
|
451
|
+
propertyMatched = true;
|
|
452
|
+
var propertySchema = s.schema.patternProperties[pattern];
|
|
453
|
+
this.addSchemaValueCompletions(propertySchema, separatorAfter, collector, types);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (s.schema.additionalProperties && !propertyMatched) {
|
|
458
|
+
var propertySchema = s.schema.additionalProperties;
|
|
400
459
|
this.addSchemaValueCompletions(propertySchema, separatorAfter, collector, types);
|
|
401
460
|
}
|
|
402
461
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.findDefinition = void 0;
|
|
16
17
|
var jsonLanguageTypes_1 = require("../jsonLanguageTypes");
|
|
17
18
|
function findDefinition(document, position, doc) {
|
|
18
19
|
var offset = document.offsetAt(position);
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.JSONDocumentSymbols = void 0;
|
|
16
17
|
var Parser = require("../parser/jsonParser");
|
|
17
18
|
var Strings = require("../utils/strings");
|
|
18
19
|
var colors_1 = require("../utils/colors");
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getFoldingRanges = void 0;
|
|
16
17
|
var jsonc_parser_1 = require("jsonc-parser");
|
|
17
18
|
var jsonLanguageTypes_1 = require("../jsonLanguageTypes");
|
|
18
19
|
function getFoldingRanges(document, context) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.JSONHover = void 0;
|
|
16
17
|
var Parser = require("../parser/jsonParser");
|
|
17
18
|
var jsonLanguageTypes_1 = require("../jsonLanguageTypes");
|
|
18
19
|
var JSONHover = /** @class */ (function () {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.JSONSchemaService = exports.ResolvedSchema = exports.UnresolvedSchema = void 0;
|
|
16
17
|
var Json = require("jsonc-parser");
|
|
17
18
|
var vscode_uri_1 = require("vscode-uri");
|
|
18
19
|
var Strings = require("../utils/strings");
|
|
@@ -168,7 +169,7 @@
|
|
|
168
169
|
get: function () {
|
|
169
170
|
return this.promiseConstructor;
|
|
170
171
|
},
|
|
171
|
-
enumerable:
|
|
172
|
+
enumerable: false,
|
|
172
173
|
configurable: true
|
|
173
174
|
});
|
|
174
175
|
JSONSchemaService.prototype.dispose = function () {
|
|
@@ -298,7 +299,7 @@
|
|
|
298
299
|
return this.promise.resolve(new ResolvedSchema({}, [localize('json.schema.draft03.notsupported', "Draft-03 schemas are not supported.")]));
|
|
299
300
|
}
|
|
300
301
|
else if (id === 'https://json-schema.org/draft/2019-09/schema') {
|
|
301
|
-
|
|
302
|
+
resolveErrors.push(localize('json.schema.draft201909.notsupported', "Draft 2019-09 schemas are not yet fully supported."));
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
var contextService = this.contextService;
|
|
@@ -417,7 +418,7 @@
|
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
420
|
}
|
|
420
|
-
collectEntries(next.items, next.additionalProperties, next.not, next.contains, next.propertyNames, next.if, next.then, next.else);
|
|
421
|
+
collectEntries(next.items, next.additionalItems, next.additionalProperties, next.not, next.contains, next.propertyNames, next.if, next.then, next.else);
|
|
421
422
|
collectMapEntries(next.definitions, next.properties, next.patternProperties, next.dependencies);
|
|
422
423
|
collectArrayEntries(next.anyOf, next.allOf, next.oneOf, next.items);
|
|
423
424
|
};
|
|
@@ -484,9 +485,24 @@
|
|
|
484
485
|
return this.addSchemaHandle(combinedSchemaId, combinedSchema);
|
|
485
486
|
}
|
|
486
487
|
};
|
|
488
|
+
JSONSchemaService.prototype.getMatchingSchemas = function (document, jsonDocument, schema) {
|
|
489
|
+
if (schema) {
|
|
490
|
+
var id = schema.id || ('schemaservice://untitled/matchingSchemas/' + idCounter++);
|
|
491
|
+
return this.resolveSchemaContent(new UnresolvedSchema(schema), id, {}).then(function (resolvedSchema) {
|
|
492
|
+
return jsonDocument.getMatchingSchemas(resolvedSchema.schema).filter(function (s) { return !s.inverted; });
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
return this.getSchemaForResource(document.uri, jsonDocument).then(function (schema) {
|
|
496
|
+
if (schema) {
|
|
497
|
+
return jsonDocument.getMatchingSchemas(schema.schema).filter(function (s) { return !s.inverted; });
|
|
498
|
+
}
|
|
499
|
+
return [];
|
|
500
|
+
});
|
|
501
|
+
};
|
|
487
502
|
return JSONSchemaService;
|
|
488
503
|
}());
|
|
489
504
|
exports.JSONSchemaService = JSONSchemaService;
|
|
505
|
+
var idCounter = 0;
|
|
490
506
|
function normalizeId(id) {
|
|
491
507
|
// remove trailing '#', normalize drive capitalization
|
|
492
508
|
try {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getSelectionRanges = void 0;
|
|
16
17
|
var jsonLanguageTypes_1 = require("../jsonLanguageTypes");
|
|
17
18
|
var jsonc_parser_1 = require("jsonc-parser");
|
|
18
19
|
function getSelectionRanges(document, positions, doc) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.JSONValidation = void 0;
|
|
16
17
|
var jsonSchemaService_1 = require("./jsonSchemaService");
|
|
17
18
|
var jsonLanguageTypes_1 = require("../jsonLanguageTypes");
|
|
18
19
|
var nls = require("vscode-nls");
|
package/lib/umd/utils/colors.js
CHANGED
package/lib/umd/utils/json.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.stringifyObject = void 0;
|
|
16
17
|
function stringifyObject(obj, indent, stringifyLiteral) {
|
|
17
18
|
if (obj !== null && typeof obj === 'object') {
|
|
18
19
|
var newIndent = indent + '\t';
|
package/lib/umd/utils/objects.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.isString = exports.isBoolean = exports.isDefined = exports.isNumber = exports.equals = void 0;
|
|
16
17
|
function equals(one, other) {
|
|
17
18
|
if (one === other) {
|
|
18
19
|
return true;
|
package/lib/umd/utils/strings.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.repeat = exports.convertSimple2RegExpPattern = exports.endsWith = exports.startsWith = void 0;
|
|
16
17
|
function startsWith(haystack, needle) {
|
|
17
18
|
if (haystack.length < needle.length) {
|
|
18
19
|
return false;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|