vscode-css-languageservice 6.3.9 → 7.0.0-next.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 +8 -0
- package/lib/esm/beautify/beautify-css.js +1437 -1606
- package/lib/esm/cssLanguageService.d.ts +2 -2
- package/lib/esm/cssLanguageService.js +18 -18
- package/lib/esm/data/webCustomData.js +13251 -2444
- package/lib/esm/languageFacts/builtinData.js +2 -1
- package/lib/esm/languageFacts/colors.js +1 -1
- package/lib/esm/languageFacts/dataManager.js +3 -3
- package/lib/esm/languageFacts/entry.js +1 -1
- package/lib/esm/languageFacts/facts.js +3 -3
- package/lib/esm/parser/cssErrors.js +1 -0
- package/lib/esm/parser/cssNodes.js +1 -1
- package/lib/esm/parser/cssParser.js +164 -17
- package/lib/esm/parser/cssSymbolScope.js +2 -2
- package/lib/esm/parser/lessParser.js +5 -5
- package/lib/esm/parser/lessScanner.js +1 -1
- package/lib/esm/parser/scssParser.js +64 -6
- package/lib/esm/parser/scssScanner.js +1 -1
- package/lib/esm/services/cssCodeActions.js +4 -4
- package/lib/esm/services/cssCompletion.js +7 -7
- package/lib/esm/services/cssFolding.js +3 -3
- package/lib/esm/services/cssFormatter.js +3 -3
- package/lib/esm/services/cssHover.js +6 -6
- package/lib/esm/services/cssNavigation.js +6 -6
- package/lib/esm/services/cssSelectionRange.js +2 -2
- package/lib/esm/services/cssValidation.js +4 -4
- package/lib/esm/services/lessCompletion.js +2 -2
- package/lib/esm/services/lint.js +5 -5
- package/lib/esm/services/lintRules.js +1 -1
- package/lib/esm/services/lintUtil.js +1 -1
- package/lib/esm/services/pathCompletion.js +3 -3
- package/lib/esm/services/scssCompletion.js +3 -3
- package/lib/esm/services/scssNavigation.js +4 -4
- package/lib/esm/services/selectorPrinting.js +3 -3
- package/package.json +20 -20
- package/lib/umd/beautify/beautify-css.js +0 -1695
- package/lib/umd/cssLanguageService.d.ts +0 -39
- package/lib/umd/cssLanguageService.js +0 -105
- package/lib/umd/cssLanguageTypes.d.ts +0 -267
- package/lib/umd/cssLanguageTypes.js +0 -89
- package/lib/umd/data/webCustomData.js +0 -33806
- package/lib/umd/languageFacts/builtinData.js +0 -154
- package/lib/umd/languageFacts/colors.js +0 -949
- package/lib/umd/languageFacts/dataManager.js +0 -101
- package/lib/umd/languageFacts/dataProvider.js +0 -86
- package/lib/umd/languageFacts/entry.js +0 -217
- package/lib/umd/languageFacts/facts.js +0 -33
- package/lib/umd/parser/cssErrors.js +0 -60
- package/lib/umd/parser/cssNodes.js +0 -1676
- package/lib/umd/parser/cssParser.js +0 -1888
- package/lib/umd/parser/cssScanner.js +0 -619
- package/lib/umd/parser/cssSymbolScope.js +0 -328
- package/lib/umd/parser/lessParser.js +0 -732
- package/lib/umd/parser/lessScanner.js +0 -70
- package/lib/umd/parser/scssErrors.js +0 -30
- package/lib/umd/parser/scssParser.js +0 -816
- package/lib/umd/parser/scssScanner.js +0 -108
- package/lib/umd/services/cssCodeActions.js +0 -89
- package/lib/umd/services/cssCompletion.js +0 -1109
- package/lib/umd/services/cssFolding.js +0 -202
- package/lib/umd/services/cssFormatter.js +0 -149
- package/lib/umd/services/cssHover.js +0 -174
- package/lib/umd/services/cssNavigation.js +0 -539
- package/lib/umd/services/cssSelectionRange.js +0 -59
- package/lib/umd/services/cssValidation.js +0 -54
- package/lib/umd/services/lessCompletion.js +0 -390
- package/lib/umd/services/lint.js +0 -577
- package/lib/umd/services/lintRules.js +0 -90
- package/lib/umd/services/lintUtil.js +0 -210
- package/lib/umd/services/pathCompletion.js +0 -171
- package/lib/umd/services/scssCompletion.js +0 -367
- package/lib/umd/services/scssNavigation.js +0 -169
- package/lib/umd/services/selectorPrinting.js +0 -575
- package/lib/umd/utils/arrays.js +0 -54
- package/lib/umd/utils/objects.js +0 -24
- package/lib/umd/utils/resources.js +0 -25
- package/lib/umd/utils/strings.js +0 -123
package/lib/umd/utils/strings.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
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.startsWith = startsWith;
|
|
17
|
-
exports.endsWith = endsWith;
|
|
18
|
-
exports.difference = difference;
|
|
19
|
-
exports.getLimitedString = getLimitedString;
|
|
20
|
-
exports.trim = trim;
|
|
21
|
-
exports.repeat = repeat;
|
|
22
|
-
exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;
|
|
23
|
-
function startsWith(haystack, needle) {
|
|
24
|
-
if (haystack.length < needle.length) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
for (let i = 0; i < needle.length; i++) {
|
|
28
|
-
if (haystack[i] !== needle[i]) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Determines if haystack ends with needle.
|
|
36
|
-
*/
|
|
37
|
-
function endsWith(haystack, needle) {
|
|
38
|
-
let diff = haystack.length - needle.length;
|
|
39
|
-
if (diff > 0) {
|
|
40
|
-
return haystack.lastIndexOf(needle) === diff;
|
|
41
|
-
}
|
|
42
|
-
else if (diff === 0) {
|
|
43
|
-
return haystack === needle;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Computes the difference score for two strings. More similar strings have a higher score.
|
|
51
|
-
* We use largest common subsequence dynamic programming approach but penalize in the end for length differences.
|
|
52
|
-
* Strings that have a large length difference will get a bad default score 0.
|
|
53
|
-
* Complexity - both time and space O(first.length * second.length)
|
|
54
|
-
* Dynamic programming LCS computation http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
|
|
55
|
-
*
|
|
56
|
-
* @param first a string
|
|
57
|
-
* @param second a string
|
|
58
|
-
*/
|
|
59
|
-
function difference(first, second, maxLenDelta = 4) {
|
|
60
|
-
let lengthDifference = Math.abs(first.length - second.length);
|
|
61
|
-
// We only compute score if length of the currentWord and length of entry.name are similar.
|
|
62
|
-
if (lengthDifference > maxLenDelta) {
|
|
63
|
-
return 0;
|
|
64
|
-
}
|
|
65
|
-
// Initialize LCS (largest common subsequence) matrix.
|
|
66
|
-
let LCS = [];
|
|
67
|
-
let zeroArray = [];
|
|
68
|
-
let i, j;
|
|
69
|
-
for (i = 0; i < second.length + 1; ++i) {
|
|
70
|
-
zeroArray.push(0);
|
|
71
|
-
}
|
|
72
|
-
for (i = 0; i < first.length + 1; ++i) {
|
|
73
|
-
LCS.push(zeroArray);
|
|
74
|
-
}
|
|
75
|
-
for (i = 1; i < first.length + 1; ++i) {
|
|
76
|
-
for (j = 1; j < second.length + 1; ++j) {
|
|
77
|
-
if (first[i - 1] === second[j - 1]) {
|
|
78
|
-
LCS[i][j] = LCS[i - 1][j - 1] + 1;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
LCS[i][j] = Math.max(LCS[i - 1][j], LCS[i][j - 1]);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return LCS[first.length][second.length] - Math.sqrt(lengthDifference);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Limit of string length.
|
|
89
|
-
*/
|
|
90
|
-
function getLimitedString(str, ellipsis = true) {
|
|
91
|
-
if (!str) {
|
|
92
|
-
return '';
|
|
93
|
-
}
|
|
94
|
-
if (str.length < 140) {
|
|
95
|
-
return str;
|
|
96
|
-
}
|
|
97
|
-
return str.slice(0, 140) + (ellipsis ? '\u2026' : '');
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Limit of string length.
|
|
101
|
-
*/
|
|
102
|
-
function trim(str, regexp) {
|
|
103
|
-
const m = regexp.exec(str);
|
|
104
|
-
if (m && m[0].length) {
|
|
105
|
-
return str.substr(0, str.length - m[0].length);
|
|
106
|
-
}
|
|
107
|
-
return str;
|
|
108
|
-
}
|
|
109
|
-
function repeat(value, count) {
|
|
110
|
-
let s = '';
|
|
111
|
-
while (count > 0) {
|
|
112
|
-
if ((count & 1) === 1) {
|
|
113
|
-
s += value;
|
|
114
|
-
}
|
|
115
|
-
value += value;
|
|
116
|
-
count = count >>> 1;
|
|
117
|
-
}
|
|
118
|
-
return s;
|
|
119
|
-
}
|
|
120
|
-
function convertSimple2RegExpPattern(pattern) {
|
|
121
|
-
return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
|
|
122
|
-
}
|
|
123
|
-
});
|