vscode-json-languageservice 5.3.0 → 5.3.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.
- package/CHANGELOG.md +4 -0
- package/lib/esm/services/jsonSchemaService.js +6 -2
- package/lib/esm/utils/propertyTree.js +9 -4
- package/lib/esm/utils/sort.js +12 -1
- package/lib/umd/services/jsonSchemaService.js +6 -2
- package/lib/umd/utils/propertyTree.js +9 -4
- package/lib/umd/utils/sort.js +12 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -33,8 +33,12 @@ class FilePatternAssociation {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
;
|
|
36
|
-
if (folderUri
|
|
37
|
-
|
|
36
|
+
if (folderUri) {
|
|
37
|
+
folderUri = normalizeResourceForMatching(folderUri);
|
|
38
|
+
if (!folderUri.endsWith('/')) {
|
|
39
|
+
folderUri = folderUri + '/';
|
|
40
|
+
}
|
|
41
|
+
this.folderUri = folderUri;
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
catch (e) {
|
|
@@ -37,19 +37,24 @@ export class PropertyTree {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function compareProperties(propertyTree1, propertyTree2) {
|
|
40
|
-
|
|
40
|
+
const propertyName1 = propertyTree1.propertyName.toLowerCase();
|
|
41
|
+
const propertyName2 = propertyTree2.propertyName.toLowerCase();
|
|
42
|
+
if (propertyName1 < propertyName2) {
|
|
41
43
|
return -1;
|
|
42
44
|
}
|
|
43
|
-
else if (
|
|
45
|
+
else if (propertyName1 > propertyName2) {
|
|
44
46
|
return 1;
|
|
45
47
|
}
|
|
46
48
|
return 0;
|
|
47
49
|
}
|
|
48
50
|
function binarySearchOnPropertyArray(propertyTreeArray, propertyTree, compare_fn) {
|
|
49
|
-
|
|
51
|
+
const propertyName = propertyTree.propertyName.toLowerCase();
|
|
52
|
+
const firstPropertyInArrayName = propertyTreeArray[0].propertyName.toLowerCase();
|
|
53
|
+
const lastPropertyInArrayName = propertyTreeArray[propertyTreeArray.length - 1].propertyName.toLowerCase();
|
|
54
|
+
if (propertyName < firstPropertyInArrayName) {
|
|
50
55
|
return 0;
|
|
51
56
|
}
|
|
52
|
-
if (
|
|
57
|
+
if (propertyName > lastPropertyInArrayName) {
|
|
53
58
|
return propertyTreeArray.length;
|
|
54
59
|
}
|
|
55
60
|
let m = 0;
|
package/lib/esm/utils/sort.js
CHANGED
|
@@ -136,6 +136,7 @@ function findJsoncPropertyTree(formattedDocument) {
|
|
|
136
136
|
childProperty.noKeyName = true;
|
|
137
137
|
lastProperty = currentProperty;
|
|
138
138
|
currentProperty = currentTree.addChildProperty(childProperty);
|
|
139
|
+
currentTree = currentProperty;
|
|
139
140
|
}
|
|
140
141
|
currentContainerStack.push(Container.Array);
|
|
141
142
|
currentProperty.type = Container.Array;
|
|
@@ -335,7 +336,13 @@ function updateSortingQueue(queue, propertyTree, beginningLineNumber) {
|
|
|
335
336
|
queue.push(new SortingRange(beginningLineNumber, propertyTree.childrenProperties));
|
|
336
337
|
}
|
|
337
338
|
else if (propertyTree.type === Container.Array) {
|
|
338
|
-
|
|
339
|
+
updateSortingQueueForArrayProperties(queue, propertyTree, beginningLineNumber);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function updateSortingQueueForArrayProperties(queue, propertyTree, beginningLineNumber) {
|
|
343
|
+
for (const subObject of propertyTree.childrenProperties) {
|
|
344
|
+
// If the child property of the array is an object, then you can sort the properties within this object
|
|
345
|
+
if (subObject.type === Container.Object) {
|
|
339
346
|
let minimumBeginningLineNumber = Infinity;
|
|
340
347
|
for (const childProperty of subObject.childrenProperties) {
|
|
341
348
|
if (childProperty.beginningLineNumber < minimumBeginningLineNumber) {
|
|
@@ -345,6 +352,10 @@ function updateSortingQueue(queue, propertyTree, beginningLineNumber) {
|
|
|
345
352
|
const diff = minimumBeginningLineNumber - subObject.beginningLineNumber;
|
|
346
353
|
queue.push(new SortingRange(beginningLineNumber + subObject.beginningLineNumber - propertyTree.beginningLineNumber + diff, subObject.childrenProperties));
|
|
347
354
|
}
|
|
355
|
+
// If the child property of the array is an array, then you need to recurse on the children properties, until you find an object to sort
|
|
356
|
+
if (subObject.type === Container.Array) {
|
|
357
|
+
updateSortingQueueForArrayProperties(queue, subObject, beginningLineNumber + subObject.beginningLineNumber - propertyTree.beginningLineNumber);
|
|
358
|
+
}
|
|
348
359
|
}
|
|
349
360
|
}
|
|
350
361
|
class SortingRange {
|
|
@@ -45,8 +45,12 @@
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
;
|
|
48
|
-
if (folderUri
|
|
49
|
-
|
|
48
|
+
if (folderUri) {
|
|
49
|
+
folderUri = normalizeResourceForMatching(folderUri);
|
|
50
|
+
if (!folderUri.endsWith('/')) {
|
|
51
|
+
folderUri = folderUri + '/';
|
|
52
|
+
}
|
|
53
|
+
this.folderUri = folderUri;
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
catch (e) {
|
|
@@ -50,19 +50,24 @@
|
|
|
50
50
|
}
|
|
51
51
|
exports.PropertyTree = PropertyTree;
|
|
52
52
|
function compareProperties(propertyTree1, propertyTree2) {
|
|
53
|
-
|
|
53
|
+
const propertyName1 = propertyTree1.propertyName.toLowerCase();
|
|
54
|
+
const propertyName2 = propertyTree2.propertyName.toLowerCase();
|
|
55
|
+
if (propertyName1 < propertyName2) {
|
|
54
56
|
return -1;
|
|
55
57
|
}
|
|
56
|
-
else if (
|
|
58
|
+
else if (propertyName1 > propertyName2) {
|
|
57
59
|
return 1;
|
|
58
60
|
}
|
|
59
61
|
return 0;
|
|
60
62
|
}
|
|
61
63
|
function binarySearchOnPropertyArray(propertyTreeArray, propertyTree, compare_fn) {
|
|
62
|
-
|
|
64
|
+
const propertyName = propertyTree.propertyName.toLowerCase();
|
|
65
|
+
const firstPropertyInArrayName = propertyTreeArray[0].propertyName.toLowerCase();
|
|
66
|
+
const lastPropertyInArrayName = propertyTreeArray[propertyTreeArray.length - 1].propertyName.toLowerCase();
|
|
67
|
+
if (propertyName < firstPropertyInArrayName) {
|
|
63
68
|
return 0;
|
|
64
69
|
}
|
|
65
|
-
if (
|
|
70
|
+
if (propertyName > lastPropertyInArrayName) {
|
|
66
71
|
return propertyTreeArray.length;
|
|
67
72
|
}
|
|
68
73
|
let m = 0;
|
package/lib/umd/utils/sort.js
CHANGED
|
@@ -149,6 +149,7 @@
|
|
|
149
149
|
childProperty.noKeyName = true;
|
|
150
150
|
lastProperty = currentProperty;
|
|
151
151
|
currentProperty = currentTree.addChildProperty(childProperty);
|
|
152
|
+
currentTree = currentProperty;
|
|
152
153
|
}
|
|
153
154
|
currentContainerStack.push(propertyTree_1.Container.Array);
|
|
154
155
|
currentProperty.type = propertyTree_1.Container.Array;
|
|
@@ -348,7 +349,13 @@
|
|
|
348
349
|
queue.push(new SortingRange(beginningLineNumber, propertyTree.childrenProperties));
|
|
349
350
|
}
|
|
350
351
|
else if (propertyTree.type === propertyTree_1.Container.Array) {
|
|
351
|
-
|
|
352
|
+
updateSortingQueueForArrayProperties(queue, propertyTree, beginningLineNumber);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function updateSortingQueueForArrayProperties(queue, propertyTree, beginningLineNumber) {
|
|
356
|
+
for (const subObject of propertyTree.childrenProperties) {
|
|
357
|
+
// If the child property of the array is an object, then you can sort the properties within this object
|
|
358
|
+
if (subObject.type === propertyTree_1.Container.Object) {
|
|
352
359
|
let minimumBeginningLineNumber = Infinity;
|
|
353
360
|
for (const childProperty of subObject.childrenProperties) {
|
|
354
361
|
if (childProperty.beginningLineNumber < minimumBeginningLineNumber) {
|
|
@@ -358,6 +365,10 @@
|
|
|
358
365
|
const diff = minimumBeginningLineNumber - subObject.beginningLineNumber;
|
|
359
366
|
queue.push(new SortingRange(beginningLineNumber + subObject.beginningLineNumber - propertyTree.beginningLineNumber + diff, subObject.childrenProperties));
|
|
360
367
|
}
|
|
368
|
+
// If the child property of the array is an array, then you need to recurse on the children properties, until you find an object to sort
|
|
369
|
+
if (subObject.type === propertyTree_1.Container.Array) {
|
|
370
|
+
updateSortingQueueForArrayProperties(queue, subObject, beginningLineNumber + subObject.beginningLineNumber - propertyTree.beginningLineNumber);
|
|
371
|
+
}
|
|
361
372
|
}
|
|
362
373
|
}
|
|
363
374
|
class SortingRange {
|