vscode-json-languageservice 5.3.9 → 5.3.10
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
|
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
|
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.10",
|
|
4
4
|
"description": "Language service for JSON",
|
|
5
5
|
"main": "./lib/umd/jsonLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/jsonLanguageService",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/mocha": "^10.0.6",
|
|
19
19
|
"@types/node": "16.x",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
21
|
-
"@typescript-eslint/parser": "^6.
|
|
22
|
-
"eslint": "^8.
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
21
|
+
"@typescript-eslint/parser": "^6.21.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.3.0",
|
|
25
25
|
"rimraf": "^5.0.5",
|
|
26
26
|
"typescript": "^5.3.3"
|
|
27
27
|
},
|