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.
- package/CHANGELOG.md +10 -2
- package/lib/esm/jsonContributions.d.ts +17 -17
- package/lib/esm/jsonContributions.js +1 -1
- package/lib/esm/jsonLanguageService.d.ts +29 -29
- package/lib/esm/jsonLanguageService.js +66 -66
- package/lib/esm/jsonLanguageTypes.d.ts +292 -279
- package/lib/esm/jsonLanguageTypes.js +55 -46
- package/lib/esm/jsonSchema.d.ts +89 -89
- package/lib/esm/jsonSchema.js +1 -1
- package/lib/esm/parser/jsonParser.js +1236 -1214
- package/lib/esm/services/configuration.js +528 -528
- package/lib/esm/services/jsonCompletion.js +924 -918
- package/lib/esm/services/jsonDocumentSymbols.js +267 -267
- package/lib/esm/services/jsonFolding.js +120 -120
- package/lib/esm/services/jsonHover.js +109 -109
- package/lib/esm/services/jsonLinks.js +72 -72
- package/lib/esm/services/jsonSchemaService.js +593 -586
- package/lib/esm/services/jsonSelectionRanges.js +61 -61
- package/lib/esm/services/jsonValidation.js +151 -151
- package/lib/esm/utils/colors.js +68 -68
- package/lib/esm/utils/glob.js +124 -124
- package/lib/esm/utils/json.js +42 -42
- package/lib/esm/utils/objects.js +68 -68
- package/lib/esm/utils/strings.js +79 -64
- package/lib/umd/jsonContributions.d.ts +17 -17
- package/lib/umd/jsonContributions.js +12 -12
- package/lib/umd/jsonLanguageService.d.ts +29 -29
- package/lib/umd/jsonLanguageService.js +94 -90
- package/lib/umd/jsonLanguageTypes.d.ts +292 -279
- package/lib/umd/jsonLanguageTypes.js +103 -93
- package/lib/umd/jsonSchema.d.ts +89 -89
- package/lib/umd/jsonSchema.js +12 -12
- package/lib/umd/parser/jsonParser.js +1265 -1243
- package/lib/umd/services/configuration.js +541 -541
- package/lib/umd/services/jsonCompletion.js +938 -932
- package/lib/umd/services/jsonDocumentSymbols.js +281 -281
- package/lib/umd/services/jsonFolding.js +134 -134
- package/lib/umd/services/jsonHover.js +123 -123
- package/lib/umd/services/jsonLinks.js +86 -86
- package/lib/umd/services/jsonSchemaService.js +609 -602
- package/lib/umd/services/jsonSelectionRanges.js +75 -75
- package/lib/umd/services/jsonValidation.js +165 -165
- package/lib/umd/utils/colors.js +84 -84
- package/lib/umd/utils/glob.js +138 -138
- package/lib/umd/utils/json.js +56 -56
- package/lib/umd/utils/objects.js +87 -87
- package/lib/umd/utils/strings.js +98 -82
- package/package.json +11 -10
package/lib/umd/utils/objects.js
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
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.isObject = exports.isString = exports.isBoolean = exports.isDefined = exports.isNumber = exports.equals = void 0;
|
|
17
|
-
function equals(one, other) {
|
|
18
|
-
if (one === other) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
if (one === null || one === undefined || other === null || other === undefined) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (typeof one !== typeof other) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
if (typeof one !== 'object') {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
if ((Array.isArray(one)) !== (Array.isArray(other))) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
var i, key;
|
|
34
|
-
if (Array.isArray(one)) {
|
|
35
|
-
if (one.length !== other.length) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
for (i = 0; i < one.length; i++) {
|
|
39
|
-
if (!equals(one[i], other[i])) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
var oneKeys = [];
|
|
46
|
-
for (key in one) {
|
|
47
|
-
oneKeys.push(key);
|
|
48
|
-
}
|
|
49
|
-
oneKeys.sort();
|
|
50
|
-
var otherKeys = [];
|
|
51
|
-
for (key in other) {
|
|
52
|
-
otherKeys.push(key);
|
|
53
|
-
}
|
|
54
|
-
otherKeys.sort();
|
|
55
|
-
if (!equals(oneKeys, otherKeys)) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
for (i = 0; i < oneKeys.length; i++) {
|
|
59
|
-
if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
exports.equals = equals;
|
|
67
|
-
function isNumber(val) {
|
|
68
|
-
return typeof val === 'number';
|
|
69
|
-
}
|
|
70
|
-
exports.isNumber = isNumber;
|
|
71
|
-
function isDefined(val) {
|
|
72
|
-
return typeof val !== 'undefined';
|
|
73
|
-
}
|
|
74
|
-
exports.isDefined = isDefined;
|
|
75
|
-
function isBoolean(val) {
|
|
76
|
-
return typeof val === 'boolean';
|
|
77
|
-
}
|
|
78
|
-
exports.isBoolean = isBoolean;
|
|
79
|
-
function isString(val) {
|
|
80
|
-
return typeof val === 'string';
|
|
81
|
-
}
|
|
82
|
-
exports.isString = isString;
|
|
83
|
-
function isObject(val) {
|
|
84
|
-
return typeof val === 'object' && val !== null && !Array.isArray(val);
|
|
85
|
-
}
|
|
86
|
-
exports.isObject = isObject;
|
|
87
|
-
});
|
|
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.isObject = exports.isString = exports.isBoolean = exports.isDefined = exports.isNumber = exports.equals = void 0;
|
|
17
|
+
function equals(one, other) {
|
|
18
|
+
if (one === other) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (one === null || one === undefined || other === null || other === undefined) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (typeof one !== typeof other) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (typeof one !== 'object') {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if ((Array.isArray(one)) !== (Array.isArray(other))) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
var i, key;
|
|
34
|
+
if (Array.isArray(one)) {
|
|
35
|
+
if (one.length !== other.length) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
for (i = 0; i < one.length; i++) {
|
|
39
|
+
if (!equals(one[i], other[i])) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
var oneKeys = [];
|
|
46
|
+
for (key in one) {
|
|
47
|
+
oneKeys.push(key);
|
|
48
|
+
}
|
|
49
|
+
oneKeys.sort();
|
|
50
|
+
var otherKeys = [];
|
|
51
|
+
for (key in other) {
|
|
52
|
+
otherKeys.push(key);
|
|
53
|
+
}
|
|
54
|
+
otherKeys.sort();
|
|
55
|
+
if (!equals(oneKeys, otherKeys)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
for (i = 0; i < oneKeys.length; i++) {
|
|
59
|
+
if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
exports.equals = equals;
|
|
67
|
+
function isNumber(val) {
|
|
68
|
+
return typeof val === 'number';
|
|
69
|
+
}
|
|
70
|
+
exports.isNumber = isNumber;
|
|
71
|
+
function isDefined(val) {
|
|
72
|
+
return typeof val !== 'undefined';
|
|
73
|
+
}
|
|
74
|
+
exports.isDefined = isDefined;
|
|
75
|
+
function isBoolean(val) {
|
|
76
|
+
return typeof val === 'boolean';
|
|
77
|
+
}
|
|
78
|
+
exports.isBoolean = isBoolean;
|
|
79
|
+
function isString(val) {
|
|
80
|
+
return typeof val === 'string';
|
|
81
|
+
}
|
|
82
|
+
exports.isString = isString;
|
|
83
|
+
function isObject(val) {
|
|
84
|
+
return typeof val === 'object' && val !== null && !Array.isArray(val);
|
|
85
|
+
}
|
|
86
|
+
exports.isObject = isObject;
|
|
87
|
+
});
|
package/lib/umd/utils/strings.js
CHANGED
|
@@ -1,82 +1,98 @@
|
|
|
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.extendedRegExp = exports.repeat = exports.convertSimple2RegExpPattern = exports.endsWith = exports.startsWith = void 0;
|
|
17
|
-
function startsWith(haystack, needle) {
|
|
18
|
-
if (haystack.length < needle.length) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
for (let i = 0; i < needle.length; i++) {
|
|
22
|
-
if (haystack[i] !== needle[i]) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
exports.startsWith = startsWith;
|
|
29
|
-
/**
|
|
30
|
-
* Determines if haystack ends with needle.
|
|
31
|
-
*/
|
|
32
|
-
function endsWith(haystack, needle) {
|
|
33
|
-
const diff = haystack.length - needle.length;
|
|
34
|
-
if (diff > 0) {
|
|
35
|
-
return haystack.lastIndexOf(needle) === diff;
|
|
36
|
-
}
|
|
37
|
-
else if (diff === 0) {
|
|
38
|
-
return haystack === needle;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.endsWith = endsWith;
|
|
45
|
-
function convertSimple2RegExpPattern(pattern) {
|
|
46
|
-
return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
|
|
47
|
-
}
|
|
48
|
-
exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;
|
|
49
|
-
function repeat(value, count) {
|
|
50
|
-
var s = '';
|
|
51
|
-
while (count > 0) {
|
|
52
|
-
if ((count & 1) === 1) {
|
|
53
|
-
s += value;
|
|
54
|
-
}
|
|
55
|
-
value += value;
|
|
56
|
-
count = count >>> 1;
|
|
57
|
-
}
|
|
58
|
-
return s;
|
|
59
|
-
}
|
|
60
|
-
exports.repeat = repeat;
|
|
61
|
-
function extendedRegExp(pattern) {
|
|
62
|
-
let flags = '';
|
|
63
|
-
if (startsWith(pattern, '(?i)')) {
|
|
64
|
-
pattern = pattern.substring(4);
|
|
65
|
-
flags = 'i';
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
return new RegExp(pattern, flags + 'u');
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
// could be an exception due to the 'u ' flag
|
|
72
|
-
try {
|
|
73
|
-
return new RegExp(pattern, flags);
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
// invalid pattern
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.extendedRegExp = extendedRegExp;
|
|
82
|
-
|
|
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.stringLength = exports.extendedRegExp = exports.repeat = exports.convertSimple2RegExpPattern = exports.endsWith = exports.startsWith = void 0;
|
|
17
|
+
function startsWith(haystack, needle) {
|
|
18
|
+
if (haystack.length < needle.length) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
for (let i = 0; i < needle.length; i++) {
|
|
22
|
+
if (haystack[i] !== needle[i]) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
exports.startsWith = startsWith;
|
|
29
|
+
/**
|
|
30
|
+
* Determines if haystack ends with needle.
|
|
31
|
+
*/
|
|
32
|
+
function endsWith(haystack, needle) {
|
|
33
|
+
const diff = haystack.length - needle.length;
|
|
34
|
+
if (diff > 0) {
|
|
35
|
+
return haystack.lastIndexOf(needle) === diff;
|
|
36
|
+
}
|
|
37
|
+
else if (diff === 0) {
|
|
38
|
+
return haystack === needle;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.endsWith = endsWith;
|
|
45
|
+
function convertSimple2RegExpPattern(pattern) {
|
|
46
|
+
return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
|
|
47
|
+
}
|
|
48
|
+
exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;
|
|
49
|
+
function repeat(value, count) {
|
|
50
|
+
var s = '';
|
|
51
|
+
while (count > 0) {
|
|
52
|
+
if ((count & 1) === 1) {
|
|
53
|
+
s += value;
|
|
54
|
+
}
|
|
55
|
+
value += value;
|
|
56
|
+
count = count >>> 1;
|
|
57
|
+
}
|
|
58
|
+
return s;
|
|
59
|
+
}
|
|
60
|
+
exports.repeat = repeat;
|
|
61
|
+
function extendedRegExp(pattern) {
|
|
62
|
+
let flags = '';
|
|
63
|
+
if (startsWith(pattern, '(?i)')) {
|
|
64
|
+
pattern = pattern.substring(4);
|
|
65
|
+
flags = 'i';
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
return new RegExp(pattern, flags + 'u');
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
// could be an exception due to the 'u ' flag
|
|
72
|
+
try {
|
|
73
|
+
return new RegExp(pattern, flags);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
// invalid pattern
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.extendedRegExp = extendedRegExp;
|
|
82
|
+
// from https://tanishiking.github.io/posts/count-unicode-codepoint/#work-hard-with-for-statements
|
|
83
|
+
function stringLength(str) {
|
|
84
|
+
let count = 0;
|
|
85
|
+
for (let i = 0; i < str.length; i++) {
|
|
86
|
+
count++;
|
|
87
|
+
// obtain the i-th 16-bit
|
|
88
|
+
const code = str.charCodeAt(i);
|
|
89
|
+
if (0xD800 <= code && code <= 0xDBFF) {
|
|
90
|
+
// if the i-th 16bit is an upper surrogate
|
|
91
|
+
// skip the next 16 bits (lower surrogate)
|
|
92
|
+
i++;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return count;
|
|
96
|
+
}
|
|
97
|
+
exports.stringLength = stringLength;
|
|
98
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-json-languageservice",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Language service for JSON",
|
|
5
5
|
"main": "./lib/umd/jsonLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/jsonLanguageService",
|
|
@@ -17,19 +17,20 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/mocha": "^9.1.1",
|
|
19
19
|
"@types/node": "16.x",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
21
|
-
"@typescript-eslint/parser": "^5.
|
|
22
|
-
"eslint": "^8.
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
|
21
|
+
"@typescript-eslint/parser": "^5.38.1",
|
|
22
|
+
"eslint": "^8.24.0",
|
|
23
23
|
"mocha": "^10.0.0",
|
|
24
24
|
"rimraf": "^3.0.2",
|
|
25
|
-
"typescript": "^4.
|
|
25
|
+
"typescript": "^4.8.3",
|
|
26
|
+
"json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"jsonc-parser": "^3.
|
|
29
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
30
|
-
"vscode-languageserver-types": "^3.17.
|
|
31
|
-
"vscode-nls": "^5.0
|
|
32
|
-
"vscode-uri": "^3.0.
|
|
29
|
+
"jsonc-parser": "^3.2.0",
|
|
30
|
+
"vscode-languageserver-textdocument": "^1.0.7",
|
|
31
|
+
"vscode-languageserver-types": "^3.17.2",
|
|
32
|
+
"vscode-nls": "^5.2.0",
|
|
33
|
+
"vscode-uri": "^3.0.6"
|
|
33
34
|
},
|
|
34
35
|
"scripts": {
|
|
35
36
|
"prepublishOnly": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
|