vscode-json-languageservice 5.3.9 → 5.3.11
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.
|
@@ -455,10 +455,11 @@ function validate(n, schema, validationResult, matchingSchemas, context) {
|
|
|
455
455
|
validationResult.enumValues = [schema.const];
|
|
456
456
|
}
|
|
457
457
|
let deprecationMessage = schema.deprecationMessage;
|
|
458
|
-
if (
|
|
458
|
+
if (deprecationMessage || schema.deprecated) {
|
|
459
459
|
deprecationMessage = deprecationMessage || l10n.t('Value is deprecated');
|
|
460
|
+
let targetNode = node.parent?.type === 'property' ? node.parent : node;
|
|
460
461
|
validationResult.problems.push({
|
|
461
|
-
location: { offset:
|
|
462
|
+
location: { offset: targetNode.offset, length: targetNode.length },
|
|
462
463
|
severity: DiagnosticSeverity.Warning,
|
|
463
464
|
message: deprecationMessage,
|
|
464
465
|
code: ErrorCode.Deprecated
|
|
@@ -683,13 +684,13 @@ function validate(n, schema, validationResult, matchingSchemas, context) {
|
|
|
683
684
|
if (isNumber(schema.minContains) && containsCount < schema.minContains) {
|
|
684
685
|
validationResult.problems.push({
|
|
685
686
|
location: { offset: node.offset, length: node.length },
|
|
686
|
-
message: l10n.t('Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
|
|
687
|
+
message: schema.errorMessage || l10n.t('Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
|
|
687
688
|
});
|
|
688
689
|
}
|
|
689
690
|
if (isNumber(schema.maxContains) && containsCount > schema.maxContains) {
|
|
690
691
|
validationResult.problems.push({
|
|
691
692
|
location: { offset: node.offset, length: node.length },
|
|
692
|
-
message: l10n.t('Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
|
|
693
|
+
message: schema.errorMessage || l10n.t('Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
|
|
693
694
|
});
|
|
694
695
|
}
|
|
695
696
|
}
|
package/lib/esm/utils/sort.js
CHANGED
|
@@ -190,15 +190,17 @@ function findJsoncPropertyTree(formattedDocument) {
|
|
|
190
190
|
case 2 /* SyntaxKind.CloseBraceToken */: {
|
|
191
191
|
endLineNumber = scanner.getTokenStartLine();
|
|
192
192
|
currentContainerStack.pop();
|
|
193
|
-
// If we are not inside of an empty object
|
|
194
|
-
if (lastNonTriviaNonCommentToken !== 1 /* SyntaxKind.OpenBraceToken */
|
|
195
|
-
|
|
196
|
-
currentProperty.endLineNumber
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
193
|
+
// If we are not inside of an empty object
|
|
194
|
+
if (lastNonTriviaNonCommentToken !== 1 /* SyntaxKind.OpenBraceToken */) {
|
|
195
|
+
// If current property end line number has not yet been defined, define it
|
|
196
|
+
if (currentProperty.endLineNumber === undefined) {
|
|
197
|
+
currentProperty.endLineNumber = endLineNumber - 1;
|
|
198
|
+
// The current property is also the last property
|
|
199
|
+
currentProperty.lastProperty = true;
|
|
200
|
+
// The last property of an object is associated with the line and index of where to add the comma, in case after sorting, it is no longer the last property
|
|
201
|
+
currentProperty.lineWhereToAddComma = lineOfLastNonTriviaNonCommentToken;
|
|
202
|
+
currentProperty.indexWhereToAddComa = endIndexOfLastNonTriviaNonCommentToken;
|
|
203
|
+
}
|
|
202
204
|
lastProperty = currentProperty;
|
|
203
205
|
currentProperty = currentProperty ? currentProperty.parent : undefined;
|
|
204
206
|
currentTree = currentProperty;
|
|
@@ -482,10 +482,11 @@
|
|
|
482
482
|
validationResult.enumValues = [schema.const];
|
|
483
483
|
}
|
|
484
484
|
let deprecationMessage = schema.deprecationMessage;
|
|
485
|
-
if (
|
|
485
|
+
if (deprecationMessage || schema.deprecated) {
|
|
486
486
|
deprecationMessage = deprecationMessage || l10n.t('Value is deprecated');
|
|
487
|
+
let targetNode = node.parent?.type === 'property' ? node.parent : node;
|
|
487
488
|
validationResult.problems.push({
|
|
488
|
-
location: { offset:
|
|
489
|
+
location: { offset: targetNode.offset, length: targetNode.length },
|
|
489
490
|
severity: jsonLanguageTypes_1.DiagnosticSeverity.Warning,
|
|
490
491
|
message: deprecationMessage,
|
|
491
492
|
code: jsonLanguageTypes_1.ErrorCode.Deprecated
|
|
@@ -710,13 +711,13 @@
|
|
|
710
711
|
if ((0, objects_1.isNumber)(schema.minContains) && containsCount < schema.minContains) {
|
|
711
712
|
validationResult.problems.push({
|
|
712
713
|
location: { offset: node.offset, length: node.length },
|
|
713
|
-
message: l10n.t('Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
|
|
714
|
+
message: schema.errorMessage || l10n.t('Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
|
|
714
715
|
});
|
|
715
716
|
}
|
|
716
717
|
if ((0, objects_1.isNumber)(schema.maxContains) && containsCount > schema.maxContains) {
|
|
717
718
|
validationResult.problems.push({
|
|
718
719
|
location: { offset: node.offset, length: node.length },
|
|
719
|
-
message: l10n.t('Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
|
|
720
|
+
message: schema.errorMessage || l10n.t('Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
|
|
720
721
|
});
|
|
721
722
|
}
|
|
722
723
|
}
|
package/lib/umd/utils/sort.js
CHANGED
|
@@ -203,15 +203,17 @@
|
|
|
203
203
|
case 2 /* SyntaxKind.CloseBraceToken */: {
|
|
204
204
|
endLineNumber = scanner.getTokenStartLine();
|
|
205
205
|
currentContainerStack.pop();
|
|
206
|
-
// If we are not inside of an empty object
|
|
207
|
-
if (lastNonTriviaNonCommentToken !== 1 /* SyntaxKind.OpenBraceToken */
|
|
208
|
-
|
|
209
|
-
currentProperty.endLineNumber
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
206
|
+
// If we are not inside of an empty object
|
|
207
|
+
if (lastNonTriviaNonCommentToken !== 1 /* SyntaxKind.OpenBraceToken */) {
|
|
208
|
+
// If current property end line number has not yet been defined, define it
|
|
209
|
+
if (currentProperty.endLineNumber === undefined) {
|
|
210
|
+
currentProperty.endLineNumber = endLineNumber - 1;
|
|
211
|
+
// The current property is also the last property
|
|
212
|
+
currentProperty.lastProperty = true;
|
|
213
|
+
// The last property of an object is associated with the line and index of where to add the comma, in case after sorting, it is no longer the last property
|
|
214
|
+
currentProperty.lineWhereToAddComma = lineOfLastNonTriviaNonCommentToken;
|
|
215
|
+
currentProperty.indexWhereToAddComa = endIndexOfLastNonTriviaNonCommentToken;
|
|
216
|
+
}
|
|
215
217
|
lastProperty = currentProperty;
|
|
216
218
|
currentProperty = currentProperty ? currentProperty.parent : undefined;
|
|
217
219
|
currentTree = currentProperty;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-json-languageservice",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.11",
|
|
4
4
|
"description": "Language service for JSON",
|
|
5
5
|
"main": "./lib/umd/jsonLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/jsonLanguageService",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/mocha": "^10.0.6",
|
|
19
19
|
"@types/node": "16.x",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
21
|
-
"@typescript-eslint/parser": "^
|
|
22
|
-
"eslint": "^8.
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
21
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
22
|
+
"eslint": "^8.57.0",
|
|
23
23
|
"json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876",
|
|
24
|
-
"mocha": "^10.
|
|
24
|
+
"mocha": "^10.4.0",
|
|
25
25
|
"rimraf": "^5.0.5",
|
|
26
|
-
"typescript": "^5.
|
|
26
|
+
"typescript": "^5.4.5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"jsonc-parser": "^3.2.1",
|