vscode-json-languageservice 5.7.2 → 6.0.0-next.2

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 (52) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/lib/esm/jsonContributions.d.ts +1 -1
  3. package/lib/esm/jsonLanguageService.d.ts +2 -2
  4. package/lib/esm/jsonLanguageService.js +13 -13
  5. package/lib/esm/jsonLanguageTypes.d.ts +10 -2
  6. package/lib/esm/jsonSchema.d.ts +71 -2
  7. package/lib/esm/parser/jsonParser.js +224 -93
  8. package/lib/esm/services/configuration.js +2 -2
  9. package/lib/esm/services/jsonCompletion.js +5 -5
  10. package/lib/esm/services/jsonDocumentSymbols.js +4 -4
  11. package/lib/esm/services/jsonFolding.js +1 -1
  12. package/lib/esm/services/jsonHover.js +2 -2
  13. package/lib/esm/services/jsonLinks.js +94 -3
  14. package/lib/esm/services/jsonSchemaService.js +639 -100
  15. package/lib/esm/services/jsonSelectionRanges.js +1 -1
  16. package/lib/esm/services/jsonValidation.js +4 -4
  17. package/lib/esm/services/schemas/draft-2019-09-flat.d.ts +1 -1
  18. package/lib/esm/services/schemas/draft-2020-12-flat.d.ts +1 -1
  19. package/lib/esm/services/vocabularies.js +139 -0
  20. package/lib/esm/utils/format.js +1 -1
  21. package/lib/esm/utils/sort.js +3 -3
  22. package/package.json +23 -20
  23. package/lib/umd/jsonContributions.d.ts +0 -21
  24. package/lib/umd/jsonContributions.js +0 -12
  25. package/lib/umd/jsonLanguageService.d.ts +0 -30
  26. package/lib/umd/jsonLanguageService.js +0 -79
  27. package/lib/umd/jsonLanguageTypes.d.ts +0 -305
  28. package/lib/umd/jsonLanguageTypes.js +0 -109
  29. package/lib/umd/jsonSchema.d.ts +0 -92
  30. package/lib/umd/jsonSchema.js +0 -12
  31. package/lib/umd/parser/jsonParser.js +0 -1365
  32. package/lib/umd/services/configuration.js +0 -536
  33. package/lib/umd/services/jsonCompletion.js +0 -982
  34. package/lib/umd/services/jsonDocumentSymbols.js +0 -285
  35. package/lib/umd/services/jsonFolding.js +0 -133
  36. package/lib/umd/services/jsonHover.js +0 -125
  37. package/lib/umd/services/jsonLinks.js +0 -85
  38. package/lib/umd/services/jsonSchemaService.js +0 -631
  39. package/lib/umd/services/jsonSelectionRanges.js +0 -74
  40. package/lib/umd/services/jsonValidation.js +0 -165
  41. package/lib/umd/services/schemas/draft-2019-09-flat.d.ts +0 -278
  42. package/lib/umd/services/schemas/draft-2019-09-flat.js +0 -314
  43. package/lib/umd/services/schemas/draft-2020-12-flat.d.ts +0 -276
  44. package/lib/umd/services/schemas/draft-2020-12-flat.js +0 -307
  45. package/lib/umd/utils/colors.js +0 -83
  46. package/lib/umd/utils/format.js +0 -33
  47. package/lib/umd/utils/glob.js +0 -137
  48. package/lib/umd/utils/json.js +0 -55
  49. package/lib/umd/utils/objects.js +0 -86
  50. package/lib/umd/utils/propertyTree.js +0 -90
  51. package/lib/umd/utils/sort.js +0 -384
  52. package/lib/umd/utils/strings.js +0 -97
@@ -1,307 +0,0 @@
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"], factory);
12
- }
13
- })(function (require, exports) {
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- // This file is generated - do not edit directly!
17
- // Derived from https://json-schema.org/draft/2020-12
18
- exports.default = {
19
- $id: 'https://json-schema.org/draft/2020-12/schema',
20
- $schema: 'https://json-schema.org/draft/2020-12/schema',
21
- title: '(Flattened static) Core and Validation specifications meta-schema',
22
- type: [
23
- 'object',
24
- 'boolean',
25
- ],
26
- properties: {
27
- definitions: {
28
- $comment: 'While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.',
29
- type: 'object',
30
- additionalProperties: {
31
- $ref: '#',
32
- },
33
- default: {},
34
- },
35
- dependencies: {
36
- $comment: '"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',
37
- type: 'object',
38
- additionalProperties: {
39
- anyOf: [
40
- {
41
- $ref: '#',
42
- },
43
- {
44
- $ref: '#/$defs/stringArray',
45
- },
46
- ],
47
- },
48
- },
49
- $id: {
50
- type: 'string',
51
- format: 'uri-reference',
52
- $comment: 'Non-empty fragments not allowed.',
53
- pattern: '^[^#]*#?$',
54
- },
55
- $schema: {
56
- type: 'string',
57
- format: 'uri',
58
- },
59
- $anchor: {
60
- type: 'string',
61
- pattern: '^[A-Za-z_][-A-Za-z0-9._]*$',
62
- },
63
- $ref: {
64
- type: 'string',
65
- format: 'uri-reference',
66
- },
67
- $dynamicRef: {
68
- type: 'string',
69
- format: 'uri-reference',
70
- },
71
- $vocabulary: {
72
- type: 'object',
73
- propertyNames: {
74
- type: 'string',
75
- format: 'uri',
76
- },
77
- additionalProperties: {
78
- type: 'boolean',
79
- },
80
- },
81
- $comment: {
82
- type: 'string',
83
- },
84
- $defs: {
85
- type: 'object',
86
- additionalProperties: {
87
- $ref: '#',
88
- },
89
- default: {},
90
- },
91
- prefixItems: {
92
- $ref: '#/$defs/schemaArray',
93
- },
94
- items: {
95
- $ref: '#',
96
- },
97
- contains: {
98
- $ref: '#',
99
- },
100
- additionalProperties: {
101
- $ref: '#',
102
- },
103
- properties: {
104
- type: 'object',
105
- additionalProperties: {
106
- $ref: '#',
107
- },
108
- default: {},
109
- },
110
- patternProperties: {
111
- type: 'object',
112
- additionalProperties: {
113
- $ref: '#',
114
- },
115
- propertyNames: {
116
- format: 'regex',
117
- },
118
- default: {},
119
- },
120
- dependentSchemas: {
121
- type: 'object',
122
- additionalProperties: {
123
- $ref: '#',
124
- },
125
- },
126
- propertyNames: {
127
- $ref: '#',
128
- },
129
- if: {
130
- $ref: '#',
131
- },
132
- then: {
133
- $ref: '#',
134
- },
135
- else: {
136
- $ref: '#',
137
- },
138
- allOf: {
139
- $ref: '#/$defs/schemaArray',
140
- },
141
- anyOf: {
142
- $ref: '#/$defs/schemaArray',
143
- },
144
- oneOf: {
145
- $ref: '#/$defs/schemaArray',
146
- },
147
- not: {
148
- $ref: '#',
149
- },
150
- unevaluatedItems: {
151
- $ref: '#',
152
- },
153
- unevaluatedProperties: {
154
- $ref: '#',
155
- },
156
- multipleOf: {
157
- type: 'number',
158
- exclusiveMinimum: 0,
159
- },
160
- maximum: {
161
- type: 'number',
162
- },
163
- exclusiveMaximum: {
164
- type: 'number',
165
- },
166
- minimum: {
167
- type: 'number',
168
- },
169
- exclusiveMinimum: {
170
- type: 'number',
171
- },
172
- maxLength: {
173
- $ref: '#/$defs/nonNegativeInteger',
174
- },
175
- minLength: {
176
- $ref: '#/$defs/nonNegativeIntegerDefault0',
177
- },
178
- pattern: {
179
- type: 'string',
180
- format: 'regex',
181
- },
182
- maxItems: {
183
- $ref: '#/$defs/nonNegativeInteger',
184
- },
185
- minItems: {
186
- $ref: '#/$defs/nonNegativeIntegerDefault0',
187
- },
188
- uniqueItems: {
189
- type: 'boolean',
190
- default: false,
191
- },
192
- maxContains: {
193
- $ref: '#/$defs/nonNegativeInteger',
194
- },
195
- minContains: {
196
- $ref: '#/$defs/nonNegativeInteger',
197
- default: 1,
198
- },
199
- maxProperties: {
200
- $ref: '#/$defs/nonNegativeInteger',
201
- },
202
- minProperties: {
203
- $ref: '#/$defs/nonNegativeIntegerDefault0',
204
- },
205
- required: {
206
- $ref: '#/$defs/stringArray',
207
- },
208
- dependentRequired: {
209
- type: 'object',
210
- additionalProperties: {
211
- $ref: '#/$defs/stringArray',
212
- },
213
- },
214
- const: true,
215
- enum: {
216
- type: 'array',
217
- items: true,
218
- },
219
- type: {
220
- anyOf: [
221
- {
222
- $ref: '#/$defs/simpleTypes',
223
- },
224
- {
225
- type: 'array',
226
- items: {
227
- $ref: '#/$defs/simpleTypes',
228
- },
229
- minItems: 1,
230
- uniqueItems: true,
231
- },
232
- ],
233
- },
234
- title: {
235
- type: 'string',
236
- },
237
- description: {
238
- type: 'string',
239
- },
240
- default: true,
241
- deprecated: {
242
- type: 'boolean',
243
- default: false,
244
- },
245
- readOnly: {
246
- type: 'boolean',
247
- default: false,
248
- },
249
- writeOnly: {
250
- type: 'boolean',
251
- default: false,
252
- },
253
- examples: {
254
- type: 'array',
255
- items: true,
256
- },
257
- format: {
258
- type: 'string',
259
- },
260
- contentMediaType: {
261
- type: 'string',
262
- },
263
- contentEncoding: {
264
- type: 'string',
265
- },
266
- contentSchema: {
267
- $ref: '#',
268
- },
269
- },
270
- $defs: {
271
- schemaArray: {
272
- type: 'array',
273
- minItems: 1,
274
- items: {
275
- $ref: '#',
276
- },
277
- },
278
- nonNegativeInteger: {
279
- type: 'integer',
280
- minimum: 0,
281
- },
282
- nonNegativeIntegerDefault0: {
283
- $ref: '#/$defs/nonNegativeInteger',
284
- default: 0,
285
- },
286
- simpleTypes: {
287
- enum: [
288
- 'array',
289
- 'boolean',
290
- 'integer',
291
- 'null',
292
- 'number',
293
- 'object',
294
- 'string',
295
- ],
296
- },
297
- stringArray: {
298
- type: 'array',
299
- items: {
300
- type: 'string',
301
- },
302
- uniqueItems: true,
303
- default: [],
304
- },
305
- },
306
- };
307
- });
@@ -1,83 +0,0 @@
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"], factory);
12
- }
13
- })(function (require, exports) {
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.hexDigit = hexDigit;
17
- exports.colorFromHex = colorFromHex;
18
- exports.colorFrom256RGB = colorFrom256RGB;
19
- const Digit0 = 48;
20
- const Digit9 = 57;
21
- const A = 65;
22
- const a = 97;
23
- const f = 102;
24
- function hexDigit(charCode) {
25
- if (charCode < Digit0) {
26
- return 0;
27
- }
28
- if (charCode <= Digit9) {
29
- return charCode - Digit0;
30
- }
31
- if (charCode < a) {
32
- charCode += (a - A);
33
- }
34
- if (charCode >= a && charCode <= f) {
35
- return charCode - a + 10;
36
- }
37
- return 0;
38
- }
39
- function colorFromHex(text) {
40
- if (text[0] !== '#') {
41
- return undefined;
42
- }
43
- switch (text.length) {
44
- case 4:
45
- return {
46
- red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
47
- green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
48
- blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
49
- alpha: 1
50
- };
51
- case 5:
52
- return {
53
- red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
54
- green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
55
- blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
56
- alpha: (hexDigit(text.charCodeAt(4)) * 0x11) / 255.0,
57
- };
58
- case 7:
59
- return {
60
- red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
61
- green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
62
- blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
63
- alpha: 1
64
- };
65
- case 9:
66
- return {
67
- red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
68
- green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
69
- blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
70
- alpha: (hexDigit(text.charCodeAt(7)) * 0x10 + hexDigit(text.charCodeAt(8))) / 255.0
71
- };
72
- }
73
- return undefined;
74
- }
75
- function colorFrom256RGB(red, green, blue, alpha = 1.0) {
76
- return {
77
- red: red / 255.0,
78
- green: green / 255.0,
79
- blue: blue / 255.0,
80
- alpha
81
- };
82
- }
83
- });
@@ -1,33 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "jsonc-parser", "../jsonLanguageTypes"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.format = format;
13
- const jsonc_parser_1 = require("jsonc-parser");
14
- const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
15
- function format(documentToFormat, formattingOptions, formattingRange) {
16
- let range = undefined;
17
- if (formattingRange) {
18
- const offset = documentToFormat.offsetAt(formattingRange.start);
19
- const length = documentToFormat.offsetAt(formattingRange.end) - offset;
20
- range = { offset, length };
21
- }
22
- const options = {
23
- tabSize: formattingOptions ? formattingOptions.tabSize : 4,
24
- insertSpaces: formattingOptions?.insertSpaces === true,
25
- insertFinalNewline: formattingOptions?.insertFinalNewline === true,
26
- eol: '\n',
27
- keepLines: formattingOptions?.keepLines === true
28
- };
29
- return (0, jsonc_parser_1.format)(documentToFormat.getText(), range, options).map(edit => {
30
- return jsonLanguageTypes_1.TextEdit.replace(jsonLanguageTypes_1.Range.create(documentToFormat.positionAt(edit.offset), documentToFormat.positionAt(edit.offset + edit.length)), edit.content);
31
- });
32
- }
33
- });
@@ -1,137 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createRegex = createRegex;
13
- /*---------------------------------------------------------------------------------------------
14
- * Copyright (c) Microsoft Corporation. All rights reserved.
15
- * Copyright (c) 2013, Nick Fitzgerald
16
- * Licensed under the MIT License. See LICENCE.md in the project root for license information.
17
- *--------------------------------------------------------------------------------------------*/
18
- function createRegex(glob, opts) {
19
- if (typeof glob !== 'string') {
20
- throw new TypeError('Expected a string');
21
- }
22
- const str = String(glob);
23
- // The regexp we are building, as a string.
24
- let reStr = "";
25
- // Whether we are matching so called "extended" globs (like bash) and should
26
- // support single character matching, matching ranges of characters, group
27
- // matching, etc.
28
- const extended = opts ? !!opts.extended : false;
29
- // When globstar is _false_ (default), '/foo/*' is translated a regexp like
30
- // '^\/foo\/.*$' which will match any string beginning with '/foo/'
31
- // When globstar is _true_, '/foo/*' is translated to regexp like
32
- // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT
33
- // which does not have a '/' to the right of it.
34
- // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but
35
- // these will not '/foo/bar/baz', '/foo/bar/baz.txt'
36
- // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
37
- // globstar is _false_
38
- const globstar = opts ? !!opts.globstar : false;
39
- // If we are doing extended matching, this boolean is true when we are inside
40
- // a group (eg {*.html,*.js}), and false otherwise.
41
- let inGroup = false;
42
- // RegExp flags (eg "i" ) to pass in to RegExp constructor.
43
- const flags = opts && typeof (opts.flags) === "string" ? opts.flags : "";
44
- let c;
45
- for (let i = 0, len = str.length; i < len; i++) {
46
- c = str[i];
47
- switch (c) {
48
- case "/":
49
- case "$":
50
- case "^":
51
- case "+":
52
- case ".":
53
- case "(":
54
- case ")":
55
- case "=":
56
- case "!":
57
- case "|":
58
- reStr += "\\" + c;
59
- break;
60
- case "?":
61
- if (extended) {
62
- reStr += ".";
63
- break;
64
- }
65
- case "[":
66
- case "]":
67
- if (extended) {
68
- reStr += c;
69
- break;
70
- }
71
- case "{":
72
- if (extended) {
73
- inGroup = true;
74
- reStr += "(";
75
- break;
76
- }
77
- case "}":
78
- if (extended) {
79
- inGroup = false;
80
- reStr += ")";
81
- break;
82
- }
83
- case ",":
84
- if (inGroup) {
85
- reStr += "|";
86
- break;
87
- }
88
- reStr += "\\" + c;
89
- break;
90
- case "*":
91
- // Move over all consecutive "*"'s.
92
- // Also store the previous and next characters
93
- const prevChar = str[i - 1];
94
- let starCount = 1;
95
- while (str[i + 1] === "*") {
96
- starCount++;
97
- i++;
98
- }
99
- const nextChar = str[i + 1];
100
- if (!globstar) {
101
- // globstar is disabled, so treat any number of "*" as one
102
- reStr += ".*";
103
- }
104
- else {
105
- // globstar is enabled, so determine if this is a globstar segment
106
- const isGlobstar = starCount > 1 // multiple "*"'s
107
- && (prevChar === "/" || prevChar === undefined || prevChar === '{' || prevChar === ',') // from the start of the segment
108
- && (nextChar === "/" || nextChar === undefined || nextChar === ',' || nextChar === '}'); // to the end of the segment
109
- if (isGlobstar) {
110
- if (nextChar === "/") {
111
- i++; // move over the "/"
112
- }
113
- else if (prevChar === '/' && reStr.endsWith('\\/')) {
114
- reStr = reStr.substr(0, reStr.length - 2);
115
- }
116
- // it's a globstar, so match zero or more path segments
117
- reStr += "((?:[^/]*(?:\/|$))*)";
118
- }
119
- else {
120
- // it's not a globstar, so only match one path segment
121
- reStr += "([^/]*)";
122
- }
123
- }
124
- break;
125
- default:
126
- reStr += c;
127
- }
128
- }
129
- // When regexp 'g' flag is specified don't
130
- // constrain the regular expression with ^ & $
131
- if (!flags || !~flags.indexOf('g')) {
132
- reStr = "^" + reStr + "$";
133
- }
134
- return new RegExp(reStr, flags);
135
- }
136
- ;
137
- });
@@ -1,55 +0,0 @@
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"], factory);
12
- }
13
- })(function (require, exports) {
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.stringifyObject = stringifyObject;
17
- function stringifyObject(obj, indent, stringifyLiteral) {
18
- if (obj !== null && typeof obj === 'object') {
19
- const newIndent = indent + '\t';
20
- if (Array.isArray(obj)) {
21
- if (obj.length === 0) {
22
- return '[]';
23
- }
24
- let result = '[\n';
25
- for (let i = 0; i < obj.length; i++) {
26
- result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
27
- if (i < obj.length - 1) {
28
- result += ',';
29
- }
30
- result += '\n';
31
- }
32
- result += indent + ']';
33
- return result;
34
- }
35
- else {
36
- const keys = Object.keys(obj);
37
- if (keys.length === 0) {
38
- return '{}';
39
- }
40
- let result = '{\n';
41
- for (let i = 0; i < keys.length; i++) {
42
- const key = keys[i];
43
- result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
44
- if (i < keys.length - 1) {
45
- result += ',';
46
- }
47
- result += '\n';
48
- }
49
- result += indent + '}';
50
- return result;
51
- }
52
- }
53
- return stringifyLiteral(obj);
54
- }
55
- });