vscode-json-languageservice 4.2.0 → 5.1.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/CHANGELOG.md +10 -1
- package/SECURITY.md +41 -0
- package/lib/esm/jsonLanguageService.js +22 -22
- package/lib/esm/jsonLanguageTypes.d.ts +3 -1
- package/lib/esm/jsonLanguageTypes.js +3 -2
- package/lib/esm/jsonSchema.d.ts +21 -2
- package/lib/esm/parser/jsonParser.js +488 -488
- package/lib/esm/services/configuration.js +9 -9
- package/lib/esm/services/jsonCompletion.js +280 -290
- package/lib/esm/services/jsonDocumentSymbols.js +88 -99
- package/lib/esm/services/jsonFolding.js +38 -39
- package/lib/esm/services/jsonHover.js +40 -43
- package/lib/esm/services/jsonLinks.js +12 -13
- package/lib/esm/services/jsonSchemaService.js +234 -253
- package/lib/esm/services/jsonSelectionRanges.js +9 -9
- package/lib/esm/services/jsonValidation.js +53 -51
- package/lib/esm/utils/colors.js +7 -8
- package/lib/esm/utils/glob.js +12 -12
- package/lib/esm/utils/json.js +7 -7
- package/lib/esm/utils/objects.js +3 -0
- package/lib/esm/utils/strings.js +3 -3
- package/lib/umd/jsonLanguageService.js +36 -32
- package/lib/umd/jsonLanguageTypes.d.ts +3 -1
- package/lib/umd/jsonLanguageTypes.js +5 -3
- package/lib/umd/jsonSchema.d.ts +21 -2
- package/lib/umd/parser/jsonParser.js +492 -482
- package/lib/umd/services/configuration.js +9 -9
- package/lib/umd/services/jsonCompletion.js +287 -296
- package/lib/umd/services/jsonDocumentSymbols.js +92 -102
- package/lib/umd/services/jsonFolding.js +40 -41
- package/lib/umd/services/jsonHover.js +42 -44
- package/lib/umd/services/jsonLinks.js +13 -14
- package/lib/umd/services/jsonSchemaService.js +241 -257
- package/lib/umd/services/jsonSelectionRanges.js +11 -11
- package/lib/umd/services/jsonValidation.js +56 -53
- package/lib/umd/utils/colors.js +7 -8
- package/lib/umd/utils/glob.js +12 -12
- package/lib/umd/utils/json.js +7 -7
- package/lib/umd/utils/objects.js +5 -1
- package/lib/umd/utils/strings.js +3 -3
- package/package.json +12 -12
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.getSelectionRanges = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
|
|
18
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
19
19
|
function getSelectionRanges(document, positions, doc) {
|
|
20
20
|
function getSelectionRange(position) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
let offset = document.offsetAt(position);
|
|
22
|
+
let node = doc.getNodeFromOffset(offset, true);
|
|
23
|
+
const result = [];
|
|
24
24
|
while (node) {
|
|
25
25
|
switch (node.type) {
|
|
26
26
|
case 'string':
|
|
27
27
|
case 'object':
|
|
28
28
|
case 'array':
|
|
29
29
|
// range without ", [ or {
|
|
30
|
-
|
|
30
|
+
const cStart = node.offset + 1, cEnd = node.offset + node.length - 1;
|
|
31
31
|
if (cStart < cEnd && offset >= cStart && offset <= cEnd) {
|
|
32
32
|
result.push(newRange(cStart, cEnd));
|
|
33
33
|
}
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
if (node.type === 'property' || node.parent && node.parent.type === 'array') {
|
|
44
|
-
|
|
44
|
+
const afterCommaOffset = getOffsetAfterNextToken(node.offset + node.length, 5 /* SyntaxKind.CommaToken */);
|
|
45
45
|
if (afterCommaOffset !== -1) {
|
|
46
46
|
result.push(newRange(node.offset, afterCommaOffset));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
node = node.parent;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
for (
|
|
51
|
+
let current = undefined;
|
|
52
|
+
for (let index = result.length - 1; index >= 0; index--) {
|
|
53
53
|
current = jsonLanguageTypes_1.SelectionRange.create(result[index], current);
|
|
54
54
|
}
|
|
55
55
|
if (!current) {
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
function newRange(start, end) {
|
|
61
61
|
return jsonLanguageTypes_1.Range.create(document.positionAt(start), document.positionAt(end));
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
const scanner = (0, jsonc_parser_1.createScanner)(document.getText(), true);
|
|
64
64
|
function getOffsetAfterNextToken(offset, expectedToken) {
|
|
65
65
|
scanner.setPosition(offset);
|
|
66
|
-
|
|
66
|
+
let token = scanner.scan();
|
|
67
67
|
if (token === expectedToken) {
|
|
68
68
|
return scanner.getTokenOffset() + scanner.getTokenLength();
|
|
69
69
|
}
|
|
@@ -14,58 +14,65 @@
|
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.JSONValidation = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
23
|
this.jsonSchemaService = jsonSchemaService;
|
|
24
24
|
this.promise = promiseConstructor;
|
|
25
25
|
this.validationEnabled = true;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
configure(raw) {
|
|
28
28
|
if (raw) {
|
|
29
29
|
this.validationEnabled = raw.validate !== false;
|
|
30
30
|
this.commentSeverity = raw.allowComments ? undefined : jsonLanguageTypes_1.DiagnosticSeverity.Error;
|
|
31
31
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var _this = this;
|
|
32
|
+
}
|
|
33
|
+
doValidation(textDocument, jsonDocument, documentSettings, schema) {
|
|
35
34
|
if (!this.validationEnabled) {
|
|
36
35
|
return this.promise.resolve([]);
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const diagnostics = [];
|
|
38
|
+
const added = {};
|
|
39
|
+
const addProblem = (problem) => {
|
|
41
40
|
// remove duplicated messages
|
|
42
|
-
|
|
41
|
+
const signature = problem.range.start.line + ' ' + problem.range.start.character + ' ' + problem.message;
|
|
43
42
|
if (!added[signature]) {
|
|
44
43
|
added[signature] = true;
|
|
45
44
|
diagnostics.push(problem);
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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;
|
|
53
52
|
if (schema) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
}
|
|
65
66
|
}
|
|
67
|
+
};
|
|
68
|
+
if (schema.errors.length) {
|
|
69
|
+
addSchemaProblem(schema.errors[0], jsonLanguageTypes_1.ErrorCode.SchemaResolveError);
|
|
66
70
|
}
|
|
67
71
|
else if (schemaValidation) {
|
|
68
|
-
|
|
72
|
+
for (const warning of schema.warnings) {
|
|
73
|
+
addSchemaProblem(warning, jsonLanguageTypes_1.ErrorCode.SchemaUnsupportedFeature);
|
|
74
|
+
}
|
|
75
|
+
const semanticErrors = jsonDocument.validate(textDocument, schema.schema, schemaValidation);
|
|
69
76
|
if (semanticErrors) {
|
|
70
77
|
semanticErrors.forEach(addProblem);
|
|
71
78
|
}
|
|
@@ -77,8 +84,7 @@
|
|
|
77
84
|
trailingCommaSeverity = undefined;
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
|
-
for (
|
|
81
|
-
var p = _a[_i];
|
|
87
|
+
for (const p of jsonDocument.syntaxErrors) {
|
|
82
88
|
if (p.code === jsonLanguageTypes_1.ErrorCode.TrailingComma) {
|
|
83
89
|
if (typeof trailingCommaSeverity !== 'number') {
|
|
84
90
|
continue;
|
|
@@ -88,40 +94,38 @@
|
|
|
88
94
|
addProblem(p);
|
|
89
95
|
}
|
|
90
96
|
if (typeof commentSeverity === 'number') {
|
|
91
|
-
|
|
92
|
-
jsonDocument.comments.forEach(
|
|
93
|
-
addProblem(jsonLanguageTypes_1.Diagnostic.create(c,
|
|
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));
|
|
94
100
|
});
|
|
95
101
|
}
|
|
96
102
|
return diagnostics;
|
|
97
103
|
};
|
|
98
104
|
if (schema) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return handle.getResolvedSchema().then(
|
|
105
|
+
const id = schema.id || ('schemaservice://untitled/' + idCounter++);
|
|
106
|
+
const handle = this.jsonSchemaService.registerExternalSchema(id, [], schema);
|
|
107
|
+
return handle.getResolvedSchema().then(resolvedSchema => {
|
|
102
108
|
return getDiagnostics(resolvedSchema);
|
|
103
109
|
});
|
|
104
110
|
}
|
|
105
|
-
return this.jsonSchemaService.getSchemaForResource(textDocument.uri, jsonDocument).then(
|
|
111
|
+
return this.jsonSchemaService.getSchemaForResource(textDocument.uri, jsonDocument).then(schema => {
|
|
106
112
|
return getDiagnostics(schema);
|
|
107
113
|
});
|
|
108
|
-
}
|
|
109
|
-
|
|
114
|
+
}
|
|
115
|
+
getLanguageStatus(textDocument, jsonDocument) {
|
|
110
116
|
return { schemas: this.jsonSchemaService.getSchemaURIsForResource(textDocument.uri, jsonDocument) };
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
}());
|
|
117
|
+
}
|
|
118
|
+
}
|
|
114
119
|
exports.JSONValidation = JSONValidation;
|
|
115
|
-
|
|
120
|
+
let idCounter = 0;
|
|
116
121
|
function schemaAllowsComments(schemaRef) {
|
|
117
122
|
if (schemaRef && typeof schemaRef === 'object') {
|
|
118
123
|
if ((0, objects_1.isBoolean)(schemaRef.allowComments)) {
|
|
119
124
|
return schemaRef.allowComments;
|
|
120
125
|
}
|
|
121
126
|
if (schemaRef.allOf) {
|
|
122
|
-
for (
|
|
123
|
-
|
|
124
|
-
var allow = schemaAllowsComments(schema);
|
|
127
|
+
for (const schema of schemaRef.allOf) {
|
|
128
|
+
const allow = schemaAllowsComments(schema);
|
|
125
129
|
if ((0, objects_1.isBoolean)(allow)) {
|
|
126
130
|
return allow;
|
|
127
131
|
}
|
|
@@ -135,14 +139,13 @@
|
|
|
135
139
|
if ((0, objects_1.isBoolean)(schemaRef.allowTrailingCommas)) {
|
|
136
140
|
return schemaRef.allowTrailingCommas;
|
|
137
141
|
}
|
|
138
|
-
|
|
142
|
+
const deprSchemaRef = schemaRef;
|
|
139
143
|
if ((0, objects_1.isBoolean)(deprSchemaRef['allowsTrailingCommas'])) { // deprecated
|
|
140
144
|
return deprSchemaRef['allowsTrailingCommas'];
|
|
141
145
|
}
|
|
142
146
|
if (schemaRef.allOf) {
|
|
143
|
-
for (
|
|
144
|
-
|
|
145
|
-
var allow = schemaAllowsTrailingCommas(schema);
|
|
147
|
+
for (const schema of schemaRef.allOf) {
|
|
148
|
+
const allow = schemaAllowsTrailingCommas(schema);
|
|
146
149
|
if ((0, objects_1.isBoolean)(allow)) {
|
|
147
150
|
return allow;
|
|
148
151
|
}
|
package/lib/umd/utils/colors.js
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.colorFrom256RGB = exports.colorFromHex = exports.hexDigit = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const Digit0 = 48;
|
|
18
|
+
const Digit9 = 57;
|
|
19
|
+
const A = 65;
|
|
20
|
+
const a = 97;
|
|
21
|
+
const f = 102;
|
|
22
22
|
function hexDigit(charCode) {
|
|
23
23
|
if (charCode < Digit0) {
|
|
24
24
|
return 0;
|
|
@@ -72,13 +72,12 @@
|
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
74
74
|
exports.colorFromHex = colorFromHex;
|
|
75
|
-
function colorFrom256RGB(red, green, blue, alpha) {
|
|
76
|
-
if (alpha === void 0) { alpha = 1.0; }
|
|
75
|
+
function colorFrom256RGB(red, green, blue, alpha = 1.0) {
|
|
77
76
|
return {
|
|
78
77
|
red: red / 255.0,
|
|
79
78
|
green: green / 255.0,
|
|
80
79
|
blue: blue / 255.0,
|
|
81
|
-
alpha
|
|
80
|
+
alpha
|
|
82
81
|
};
|
|
83
82
|
}
|
|
84
83
|
exports.colorFrom256RGB = colorFrom256RGB;
|
package/lib/umd/utils/glob.js
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
if (typeof glob !== 'string') {
|
|
20
20
|
throw new TypeError('Expected a string');
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
const str = String(glob);
|
|
23
23
|
// The regexp we are building, as a string.
|
|
24
|
-
|
|
24
|
+
let reStr = "";
|
|
25
25
|
// Whether we are matching so called "extended" globs (like bash) and should
|
|
26
26
|
// support single character matching, matching ranges of characters, group
|
|
27
27
|
// matching, etc.
|
|
28
|
-
|
|
28
|
+
const extended = opts ? !!opts.extended : false;
|
|
29
29
|
// When globstar is _false_ (default), '/foo/*' is translated a regexp like
|
|
30
30
|
// '^\/foo\/.*$' which will match any string beginning with '/foo/'
|
|
31
31
|
// When globstar is _true_, '/foo/*' is translated to regexp like
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
// these will not '/foo/bar/baz', '/foo/bar/baz.txt'
|
|
36
36
|
// Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
|
|
37
37
|
// globstar is _false_
|
|
38
|
-
|
|
38
|
+
const globstar = opts ? !!opts.globstar : false;
|
|
39
39
|
// If we are doing extended matching, this boolean is true when we are inside
|
|
40
40
|
// a group (eg {*.html,*.js}), and false otherwise.
|
|
41
|
-
|
|
41
|
+
let inGroup = false;
|
|
42
42
|
// RegExp flags (eg "i" ) to pass in to RegExp constructor.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
for (
|
|
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
46
|
c = str[i];
|
|
47
47
|
switch (c) {
|
|
48
48
|
case "/":
|
|
@@ -90,20 +90,20 @@
|
|
|
90
90
|
case "*":
|
|
91
91
|
// Move over all consecutive "*"'s.
|
|
92
92
|
// Also store the previous and next characters
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const prevChar = str[i - 1];
|
|
94
|
+
let starCount = 1;
|
|
95
95
|
while (str[i + 1] === "*") {
|
|
96
96
|
starCount++;
|
|
97
97
|
i++;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
const nextChar = str[i + 1];
|
|
100
100
|
if (!globstar) {
|
|
101
101
|
// globstar is disabled, so treat any number of "*" as one
|
|
102
102
|
reStr += ".*";
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
105
|
// globstar is enabled, so determine if this is a globstar segment
|
|
106
|
-
|
|
106
|
+
const isGlobstar = starCount > 1 // multiple "*"'s
|
|
107
107
|
&& (prevChar === "/" || prevChar === undefined || prevChar === '{' || prevChar === ',') // from the start of the segment
|
|
108
108
|
&& (nextChar === "/" || nextChar === undefined || nextChar === ',' || nextChar === '}'); // to the end of the segment
|
|
109
109
|
if (isGlobstar) {
|
package/lib/umd/utils/json.js
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
exports.stringifyObject = void 0;
|
|
17
17
|
function stringifyObject(obj, indent, stringifyLiteral) {
|
|
18
18
|
if (obj !== null && typeof obj === 'object') {
|
|
19
|
-
|
|
19
|
+
const newIndent = indent + '\t';
|
|
20
20
|
if (Array.isArray(obj)) {
|
|
21
21
|
if (obj.length === 0) {
|
|
22
22
|
return '[]';
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
for (
|
|
24
|
+
let result = '[\n';
|
|
25
|
+
for (let i = 0; i < obj.length; i++) {
|
|
26
26
|
result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
|
|
27
27
|
if (i < obj.length - 1) {
|
|
28
28
|
result += ',';
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
return result;
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
|
|
36
|
+
const keys = Object.keys(obj);
|
|
37
37
|
if (keys.length === 0) {
|
|
38
38
|
return '{}';
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
for (
|
|
42
|
-
|
|
40
|
+
let result = '{\n';
|
|
41
|
+
for (let i = 0; i < keys.length; i++) {
|
|
42
|
+
const key = keys[i];
|
|
43
43
|
result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
|
|
44
44
|
if (i < keys.length - 1) {
|
|
45
45
|
result += ',';
|
package/lib/umd/utils/objects.js
CHANGED
|
@@ -13,7 +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
|
+
exports.isObject = exports.isString = exports.isBoolean = exports.isDefined = exports.isNumber = exports.equals = void 0;
|
|
17
17
|
function equals(one, other) {
|
|
18
18
|
if (one === other) {
|
|
19
19
|
return true;
|
|
@@ -80,4 +80,8 @@
|
|
|
80
80
|
return typeof val === 'string';
|
|
81
81
|
}
|
|
82
82
|
exports.isString = isString;
|
|
83
|
+
function isObject(val) {
|
|
84
|
+
return typeof val === 'object' && val !== null && !Array.isArray(val);
|
|
85
|
+
}
|
|
86
|
+
exports.isObject = isObject;
|
|
83
87
|
});
|
package/lib/umd/utils/strings.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
if (haystack.length < needle.length) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
-
for (
|
|
21
|
+
for (let i = 0; i < needle.length; i++) {
|
|
22
22
|
if (haystack[i] !== needle[i]) {
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* Determines if haystack ends with needle.
|
|
31
31
|
*/
|
|
32
32
|
function endsWith(haystack, needle) {
|
|
33
|
-
|
|
33
|
+
const diff = haystack.length - needle.length;
|
|
34
34
|
if (diff > 0) {
|
|
35
35
|
return haystack.lastIndexOf(needle) === diff;
|
|
36
36
|
}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
exports.repeat = repeat;
|
|
61
61
|
function extendedRegExp(pattern) {
|
|
62
|
-
|
|
62
|
+
let flags = '';
|
|
63
63
|
if (startsWith(pattern, '(?i)')) {
|
|
64
64
|
pattern = pattern.substring(4);
|
|
65
65
|
flags = 'i';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-json-languageservice",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Language service for JSON",
|
|
5
5
|
"main": "./lib/umd/jsonLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/jsonLanguageService",
|
|
@@ -15,20 +15,20 @@
|
|
|
15
15
|
"url": "https://github.com/Microsoft/vscode-json-languageservice"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/mocha": "^9.1.
|
|
19
|
-
"@types/node": "
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
21
|
-
"@typescript-eslint/parser": "^5.
|
|
22
|
-
"eslint": "^8.
|
|
23
|
-
"mocha": "^
|
|
18
|
+
"@types/mocha": "^9.1.1",
|
|
19
|
+
"@types/node": "16.x",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
|
21
|
+
"@typescript-eslint/parser": "^5.30.6",
|
|
22
|
+
"eslint": "^8.19.0",
|
|
23
|
+
"mocha": "^10.0.0",
|
|
24
24
|
"rimraf": "^3.0.2",
|
|
25
|
-
"typescript": "^4.
|
|
25
|
+
"typescript": "^4.7.4"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"jsonc-parser": "^3.
|
|
29
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
30
|
-
"vscode-languageserver-types": "^3.
|
|
31
|
-
"vscode-nls": "^5.0.
|
|
28
|
+
"jsonc-parser": "^3.1.0",
|
|
29
|
+
"vscode-languageserver-textdocument": "^1.0.4",
|
|
30
|
+
"vscode-languageserver-types": "^3.17.1",
|
|
31
|
+
"vscode-nls": "^5.0.1",
|
|
32
32
|
"vscode-uri": "^3.0.3"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|