vscode-css-languageservice 5.4.1 → 6.0.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 +5 -1
- package/README.md +1 -0
- package/lib/esm/beautify/beautify-css.js +50 -8
- package/lib/esm/cssLanguageService.d.ts +37 -37
- package/lib/esm/cssLanguageService.js +72 -75
- package/lib/esm/cssLanguageTypes.d.ts +238 -238
- package/lib/esm/cssLanguageTypes.js +42 -42
- package/lib/esm/data/webCustomData.js +21959 -21965
- package/lib/esm/languageFacts/builtinData.js +142 -142
- package/lib/esm/languageFacts/colors.js +469 -472
- package/lib/esm/languageFacts/dataManager.js +88 -92
- package/lib/esm/languageFacts/dataProvider.js +73 -79
- package/lib/esm/languageFacts/entry.js +137 -138
- package/lib/esm/languageFacts/facts.js +8 -8
- package/lib/esm/parser/cssErrors.js +48 -50
- package/lib/esm/parser/cssNodes.js +1502 -2019
- package/lib/esm/parser/cssParser.js +1534 -1566
- package/lib/esm/parser/cssScanner.js +592 -599
- package/lib/esm/parser/cssSymbolScope.js +311 -341
- package/lib/esm/parser/lessParser.js +714 -740
- package/lib/esm/parser/lessScanner.js +57 -78
- package/lib/esm/parser/scssErrors.js +18 -20
- package/lib/esm/parser/scssParser.js +796 -818
- package/lib/esm/parser/scssScanner.js +95 -116
- package/lib/esm/services/cssCodeActions.js +77 -81
- package/lib/esm/services/cssCompletion.js +1054 -1149
- package/lib/esm/services/cssFolding.js +190 -193
- package/lib/esm/services/cssFormatter.js +136 -136
- package/lib/esm/services/cssHover.js +148 -151
- package/lib/esm/services/cssNavigation.js +378 -470
- package/lib/esm/services/cssSelectionRange.js +47 -47
- package/lib/esm/services/cssValidation.js +41 -44
- package/lib/esm/services/lessCompletion.js +378 -397
- package/lib/esm/services/lint.js +518 -532
- package/lib/esm/services/lintRules.js +76 -83
- package/lib/esm/services/lintUtil.js +196 -205
- package/lib/esm/services/pathCompletion.js +157 -231
- package/lib/esm/services/scssCompletion.js +354 -378
- package/lib/esm/services/scssNavigation.js +82 -154
- package/lib/esm/services/selectorPrinting.js +492 -536
- package/lib/esm/utils/arrays.js +40 -46
- package/lib/esm/utils/objects.js +11 -11
- package/lib/esm/utils/resources.js +11 -24
- package/lib/esm/utils/strings.js +102 -104
- package/lib/umd/beautify/beautify-css.js +50 -8
- package/lib/umd/cssLanguageService.d.ts +37 -37
- package/lib/umd/cssLanguageService.js +99 -102
- package/lib/umd/cssLanguageTypes.d.ts +238 -238
- package/lib/umd/cssLanguageTypes.js +89 -88
- package/lib/umd/data/webCustomData.js +21972 -21978
- package/lib/umd/languageFacts/builtinData.js +154 -154
- package/lib/umd/languageFacts/colors.js +492 -495
- package/lib/umd/languageFacts/dataManager.js +101 -104
- package/lib/umd/languageFacts/dataProvider.js +86 -91
- package/lib/umd/languageFacts/entry.js +152 -153
- package/lib/umd/languageFacts/facts.js +29 -29
- package/lib/umd/parser/cssErrors.js +61 -62
- package/lib/umd/parser/cssNodes.js +1587 -2034
- package/lib/umd/parser/cssParser.js +1547 -1578
- package/lib/umd/parser/cssScanner.js +606 -611
- package/lib/umd/parser/cssSymbolScope.js +328 -353
- package/lib/umd/parser/lessParser.js +727 -752
- package/lib/umd/parser/lessScanner.js +70 -90
- package/lib/umd/parser/scssErrors.js +31 -32
- package/lib/umd/parser/scssParser.js +809 -830
- package/lib/umd/parser/scssScanner.js +108 -128
- package/lib/umd/services/cssCodeActions.js +90 -93
- package/lib/umd/services/cssCompletion.js +1067 -1161
- package/lib/umd/services/cssFolding.js +203 -206
- package/lib/umd/services/cssFormatter.js +150 -150
- package/lib/umd/services/cssHover.js +161 -163
- package/lib/umd/services/cssNavigation.js +391 -482
- package/lib/umd/services/cssSelectionRange.js +60 -60
- package/lib/umd/services/cssValidation.js +54 -56
- package/lib/umd/services/lessCompletion.js +391 -409
- package/lib/umd/services/lint.js +531 -544
- package/lib/umd/services/lintRules.js +91 -95
- package/lib/umd/services/lintUtil.js +210 -218
- package/lib/umd/services/pathCompletion.js +171 -244
- package/lib/umd/services/scssCompletion.js +367 -390
- package/lib/umd/services/scssNavigation.js +95 -166
- package/lib/umd/services/selectorPrinting.js +510 -550
- package/lib/umd/utils/arrays.js +55 -61
- package/lib/umd/utils/objects.js +25 -25
- package/lib/umd/utils/resources.js +26 -39
- package/lib/umd/utils/strings.js +120 -122
- package/package.json +11 -11
package/lib/umd/utils/arrays.js
CHANGED
|
@@ -1,61 +1,55 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
/*---------------------------------------------------------------------------------------------
|
|
11
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
|
-
*--------------------------------------------------------------------------------------------*/
|
|
14
|
-
'use strict';
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.union = exports.includes = exports.findFirst = void 0;
|
|
17
|
-
/**
|
|
18
|
-
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
|
|
19
|
-
* are located before all elements where p(x) is true.
|
|
20
|
-
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
|
|
21
|
-
*/
|
|
22
|
-
function findFirst(array, p) {
|
|
23
|
-
|
|
24
|
-
if (high === 0) {
|
|
25
|
-
return 0; // no children
|
|
26
|
-
}
|
|
27
|
-
while (low < high) {
|
|
28
|
-
|
|
29
|
-
if (p(array[mid])) {
|
|
30
|
-
high = mid;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
low = mid + 1;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return low;
|
|
37
|
-
}
|
|
38
|
-
exports.findFirst = findFirst;
|
|
39
|
-
function includes(array, item) {
|
|
40
|
-
return array.indexOf(item) !== -1;
|
|
41
|
-
}
|
|
42
|
-
exports.includes = includes;
|
|
43
|
-
function union() {
|
|
44
|
-
|
|
45
|
-
for (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
exports.union = union;
|
|
61
|
-
});
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
/*---------------------------------------------------------------------------------------------
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
|
+
*--------------------------------------------------------------------------------------------*/
|
|
14
|
+
'use strict';
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.union = exports.includes = exports.findFirst = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
|
|
19
|
+
* are located before all elements where p(x) is true.
|
|
20
|
+
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
|
|
21
|
+
*/
|
|
22
|
+
function findFirst(array, p) {
|
|
23
|
+
let low = 0, high = array.length;
|
|
24
|
+
if (high === 0) {
|
|
25
|
+
return 0; // no children
|
|
26
|
+
}
|
|
27
|
+
while (low < high) {
|
|
28
|
+
let mid = Math.floor((low + high) / 2);
|
|
29
|
+
if (p(array[mid])) {
|
|
30
|
+
high = mid;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
low = mid + 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return low;
|
|
37
|
+
}
|
|
38
|
+
exports.findFirst = findFirst;
|
|
39
|
+
function includes(array, item) {
|
|
40
|
+
return array.indexOf(item) !== -1;
|
|
41
|
+
}
|
|
42
|
+
exports.includes = includes;
|
|
43
|
+
function union(...arrays) {
|
|
44
|
+
const result = [];
|
|
45
|
+
for (const array of arrays) {
|
|
46
|
+
for (const item of array) {
|
|
47
|
+
if (!includes(result, item)) {
|
|
48
|
+
result.push(item);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
exports.union = union;
|
|
55
|
+
});
|
package/lib/umd/utils/objects.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
/*---------------------------------------------------------------------------------------------
|
|
11
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
|
-
*--------------------------------------------------------------------------------------------*/
|
|
14
|
-
'use strict';
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.isDefined = exports.values = void 0;
|
|
17
|
-
function values(obj) {
|
|
18
|
-
return Object.keys(obj).map(
|
|
19
|
-
}
|
|
20
|
-
exports.values = values;
|
|
21
|
-
function isDefined(obj) {
|
|
22
|
-
return typeof obj !== 'undefined';
|
|
23
|
-
}
|
|
24
|
-
exports.isDefined = isDefined;
|
|
25
|
-
});
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
/*---------------------------------------------------------------------------------------------
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
|
+
*--------------------------------------------------------------------------------------------*/
|
|
14
|
+
'use strict';
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.isDefined = exports.values = void 0;
|
|
17
|
+
function values(obj) {
|
|
18
|
+
return Object.keys(obj).map(key => obj[key]);
|
|
19
|
+
}
|
|
20
|
+
exports.values = values;
|
|
21
|
+
function isDefined(obj) {
|
|
22
|
+
return typeof obj !== 'undefined';
|
|
23
|
+
}
|
|
24
|
+
exports.isDefined = isDefined;
|
|
25
|
+
});
|
|
@@ -1,39 +1,26 @@
|
|
|
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
|
-
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
exports.joinPath =
|
|
26
|
-
|
|
27
|
-
function dirname(uriString) {
|
|
28
|
-
return vscode_uri_1.Utils.dirname(vscode_uri_1.URI.parse(uriString)).toString();
|
|
29
|
-
}
|
|
30
|
-
exports.dirname = dirname;
|
|
31
|
-
function joinPath(uriString) {
|
|
32
|
-
var paths = [];
|
|
33
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
34
|
-
paths[_i - 1] = arguments[_i];
|
|
35
|
-
}
|
|
36
|
-
return vscode_uri_1.Utils.joinPath.apply(vscode_uri_1.Utils, __spreadArray([vscode_uri_1.URI.parse(uriString)], paths, false)).toString();
|
|
37
|
-
}
|
|
38
|
-
exports.joinPath = joinPath;
|
|
39
|
-
});
|
|
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", "vscode-uri"], factory);
|
|
12
|
+
}
|
|
13
|
+
})(function (require, exports) {
|
|
14
|
+
"use strict";
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.joinPath = exports.dirname = void 0;
|
|
17
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
18
|
+
function dirname(uriString) {
|
|
19
|
+
return vscode_uri_1.Utils.dirname(vscode_uri_1.URI.parse(uriString)).toString();
|
|
20
|
+
}
|
|
21
|
+
exports.dirname = dirname;
|
|
22
|
+
function joinPath(uriString, ...paths) {
|
|
23
|
+
return vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(uriString), ...paths).toString();
|
|
24
|
+
}
|
|
25
|
+
exports.joinPath = joinPath;
|
|
26
|
+
});
|
package/lib/umd/utils/strings.js
CHANGED
|
@@ -1,122 +1,120 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
/*---------------------------------------------------------------------------------------------
|
|
11
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
|
-
*--------------------------------------------------------------------------------------------*/
|
|
14
|
-
'use strict';
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.repeat = exports.trim = exports.getLimitedString = exports.difference = exports.endsWith = exports.startsWith = void 0;
|
|
17
|
-
function startsWith(haystack, needle) {
|
|
18
|
-
if (haystack.length < needle.length) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
for (
|
|
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
|
-
|
|
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
|
-
/**
|
|
46
|
-
* Computes the difference score for two strings. More similar strings have a higher score.
|
|
47
|
-
* We use largest common subsequence dynamic programming approach but penalize in the end for length differences.
|
|
48
|
-
* Strings that have a large length difference will get a bad default score 0.
|
|
49
|
-
* Complexity - both time and space O(first.length * second.length)
|
|
50
|
-
* Dynamic programming LCS computation http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
|
|
51
|
-
*
|
|
52
|
-
* @param first a string
|
|
53
|
-
* @param second a string
|
|
54
|
-
*/
|
|
55
|
-
function difference(first, second, maxLenDelta) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
exports.repeat = repeat;
|
|
122
|
-
});
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
/*---------------------------------------------------------------------------------------------
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
|
+
*--------------------------------------------------------------------------------------------*/
|
|
14
|
+
'use strict';
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.repeat = exports.trim = exports.getLimitedString = exports.difference = 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
|
+
let 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
|
+
/**
|
|
46
|
+
* Computes the difference score for two strings. More similar strings have a higher score.
|
|
47
|
+
* We use largest common subsequence dynamic programming approach but penalize in the end for length differences.
|
|
48
|
+
* Strings that have a large length difference will get a bad default score 0.
|
|
49
|
+
* Complexity - both time and space O(first.length * second.length)
|
|
50
|
+
* Dynamic programming LCS computation http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
|
|
51
|
+
*
|
|
52
|
+
* @param first a string
|
|
53
|
+
* @param second a string
|
|
54
|
+
*/
|
|
55
|
+
function difference(first, second, maxLenDelta = 4) {
|
|
56
|
+
let lengthDifference = Math.abs(first.length - second.length);
|
|
57
|
+
// We only compute score if length of the currentWord and length of entry.name are similar.
|
|
58
|
+
if (lengthDifference > maxLenDelta) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
// Initialize LCS (largest common subsequence) matrix.
|
|
62
|
+
let LCS = [];
|
|
63
|
+
let zeroArray = [];
|
|
64
|
+
let i, j;
|
|
65
|
+
for (i = 0; i < second.length + 1; ++i) {
|
|
66
|
+
zeroArray.push(0);
|
|
67
|
+
}
|
|
68
|
+
for (i = 0; i < first.length + 1; ++i) {
|
|
69
|
+
LCS.push(zeroArray);
|
|
70
|
+
}
|
|
71
|
+
for (i = 1; i < first.length + 1; ++i) {
|
|
72
|
+
for (j = 1; j < second.length + 1; ++j) {
|
|
73
|
+
if (first[i - 1] === second[j - 1]) {
|
|
74
|
+
LCS[i][j] = LCS[i - 1][j - 1] + 1;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
LCS[i][j] = Math.max(LCS[i - 1][j], LCS[i][j - 1]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return LCS[first.length][second.length] - Math.sqrt(lengthDifference);
|
|
82
|
+
}
|
|
83
|
+
exports.difference = difference;
|
|
84
|
+
/**
|
|
85
|
+
* Limit of string length.
|
|
86
|
+
*/
|
|
87
|
+
function getLimitedString(str, ellipsis = true) {
|
|
88
|
+
if (!str) {
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
if (str.length < 140) {
|
|
92
|
+
return str;
|
|
93
|
+
}
|
|
94
|
+
return str.slice(0, 140) + (ellipsis ? '\u2026' : '');
|
|
95
|
+
}
|
|
96
|
+
exports.getLimitedString = getLimitedString;
|
|
97
|
+
/**
|
|
98
|
+
* Limit of string length.
|
|
99
|
+
*/
|
|
100
|
+
function trim(str, regexp) {
|
|
101
|
+
const m = regexp.exec(str);
|
|
102
|
+
if (m && m[0].length) {
|
|
103
|
+
return str.substr(0, str.length - m[0].length);
|
|
104
|
+
}
|
|
105
|
+
return str;
|
|
106
|
+
}
|
|
107
|
+
exports.trim = trim;
|
|
108
|
+
function repeat(value, count) {
|
|
109
|
+
let s = '';
|
|
110
|
+
while (count > 0) {
|
|
111
|
+
if ((count & 1) === 1) {
|
|
112
|
+
s += value;
|
|
113
|
+
}
|
|
114
|
+
value += value;
|
|
115
|
+
count = count >>> 1;
|
|
116
|
+
}
|
|
117
|
+
return s;
|
|
118
|
+
}
|
|
119
|
+
exports.repeat = repeat;
|
|
120
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-css-languageservice",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Language service for CSS, LESS and SCSS",
|
|
5
5
|
"main": "./lib/umd/cssLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/cssLanguageService",
|
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
"url": "https://github.com/Microsoft/vscode-css-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
|
-
"@vscode/web-custom-data": "^0.3.
|
|
23
|
-
"eslint": "^8.
|
|
24
|
-
"js-beautify": "^1.14.
|
|
25
|
-
"mocha": "^
|
|
18
|
+
"@types/mocha": "^9.1.1",
|
|
19
|
+
"@types/node": "16.x",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
|
21
|
+
"@typescript-eslint/parser": "^5.25.0",
|
|
22
|
+
"@vscode/web-custom-data": "^0.3.10",
|
|
23
|
+
"eslint": "^8.15.0",
|
|
24
|
+
"js-beautify": "^1.14.3",
|
|
25
|
+
"mocha": "^10.0.0",
|
|
26
26
|
"rimraf": "^3.0.2",
|
|
27
27
|
"typescript": "^4.5.5"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"vscode-languageserver-textdocument": "^1.0.4",
|
|
31
|
-
"vscode-languageserver-types": "^3.
|
|
32
|
-
"vscode-nls": "^5.0.
|
|
31
|
+
"vscode-languageserver-types": "^3.17.1",
|
|
32
|
+
"vscode-nls": "^5.0.1",
|
|
33
33
|
"vscode-uri": "^3.0.3"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|