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/esm/utils/arrays.js
CHANGED
|
@@ -1,46 +1,40 @@
|
|
|
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
|
-
'use strict';
|
|
6
|
-
/**
|
|
7
|
-
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
|
|
8
|
-
* are located before all elements where p(x) is true.
|
|
9
|
-
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
|
|
10
|
-
*/
|
|
11
|
-
export function findFirst(array, p) {
|
|
12
|
-
|
|
13
|
-
if (high === 0) {
|
|
14
|
-
return 0; // no children
|
|
15
|
-
}
|
|
16
|
-
while (low < high) {
|
|
17
|
-
|
|
18
|
-
if (p(array[mid])) {
|
|
19
|
-
high = mid;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
low = mid + 1;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return low;
|
|
26
|
-
}
|
|
27
|
-
export function includes(array, item) {
|
|
28
|
-
return array.indexOf(item) !== -1;
|
|
29
|
-
}
|
|
30
|
-
export function union() {
|
|
31
|
-
|
|
32
|
-
for (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
result.push(item);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
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
|
+
'use strict';
|
|
6
|
+
/**
|
|
7
|
+
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
|
|
8
|
+
* are located before all elements where p(x) is true.
|
|
9
|
+
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
|
|
10
|
+
*/
|
|
11
|
+
export function findFirst(array, p) {
|
|
12
|
+
let low = 0, high = array.length;
|
|
13
|
+
if (high === 0) {
|
|
14
|
+
return 0; // no children
|
|
15
|
+
}
|
|
16
|
+
while (low < high) {
|
|
17
|
+
let mid = Math.floor((low + high) / 2);
|
|
18
|
+
if (p(array[mid])) {
|
|
19
|
+
high = mid;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
low = mid + 1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return low;
|
|
26
|
+
}
|
|
27
|
+
export function includes(array, item) {
|
|
28
|
+
return array.indexOf(item) !== -1;
|
|
29
|
+
}
|
|
30
|
+
export function union(...arrays) {
|
|
31
|
+
const result = [];
|
|
32
|
+
for (const array of arrays) {
|
|
33
|
+
for (const item of array) {
|
|
34
|
+
if (!includes(result, item)) {
|
|
35
|
+
result.push(item);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
package/lib/esm/utils/objects.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
-
'use strict';
|
|
6
|
-
export function values(obj) {
|
|
7
|
-
return Object.keys(obj).map(
|
|
8
|
-
}
|
|
9
|
-
export function isDefined(obj) {
|
|
10
|
-
return typeof obj !== 'undefined';
|
|
11
|
-
}
|
|
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
|
+
'use strict';
|
|
6
|
+
export function values(obj) {
|
|
7
|
+
return Object.keys(obj).map(key => obj[key]);
|
|
8
|
+
}
|
|
9
|
+
export function isDefined(obj) {
|
|
10
|
+
return typeof obj !== 'undefined';
|
|
11
|
+
}
|
|
@@ -1,24 +1,11 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
13
|
-
};
|
|
14
|
-
import { URI, Utils } from 'vscode-uri';
|
|
15
|
-
export function dirname(uriString) {
|
|
16
|
-
return Utils.dirname(URI.parse(uriString)).toString();
|
|
17
|
-
}
|
|
18
|
-
export function joinPath(uriString) {
|
|
19
|
-
var paths = [];
|
|
20
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
21
|
-
paths[_i - 1] = arguments[_i];
|
|
22
|
-
}
|
|
23
|
-
return Utils.joinPath.apply(Utils, __spreadArray([URI.parse(uriString)], paths, false)).toString();
|
|
24
|
-
}
|
|
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
|
+
import { URI, Utils } from 'vscode-uri';
|
|
6
|
+
export function dirname(uriString) {
|
|
7
|
+
return Utils.dirname(URI.parse(uriString)).toString();
|
|
8
|
+
}
|
|
9
|
+
export function joinPath(uriString, ...paths) {
|
|
10
|
+
return Utils.joinPath(URI.parse(uriString), ...paths).toString();
|
|
11
|
+
}
|
package/lib/esm/utils/strings.js
CHANGED
|
@@ -1,104 +1,102 @@
|
|
|
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
|
-
'use strict';
|
|
6
|
-
export function startsWith(haystack, needle) {
|
|
7
|
-
if (haystack.length < needle.length) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
for (
|
|
11
|
-
if (haystack[i] !== needle[i]) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Determines if haystack ends with needle.
|
|
19
|
-
*/
|
|
20
|
-
export function endsWith(haystack, needle) {
|
|
21
|
-
|
|
22
|
-
if (diff > 0) {
|
|
23
|
-
return haystack.lastIndexOf(needle) === diff;
|
|
24
|
-
}
|
|
25
|
-
else if (diff === 0) {
|
|
26
|
-
return haystack === needle;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Computes the difference score for two strings. More similar strings have a higher score.
|
|
34
|
-
* We use largest common subsequence dynamic programming approach but penalize in the end for length differences.
|
|
35
|
-
* Strings that have a large length difference will get a bad default score 0.
|
|
36
|
-
* Complexity - both time and space O(first.length * second.length)
|
|
37
|
-
* Dynamic programming LCS computation http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
|
|
38
|
-
*
|
|
39
|
-
* @param first a string
|
|
40
|
-
* @param second a string
|
|
41
|
-
*/
|
|
42
|
-
export function difference(first, second, maxLenDelta) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
return s;
|
|
104
|
-
}
|
|
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
|
+
'use strict';
|
|
6
|
+
export function startsWith(haystack, needle) {
|
|
7
|
+
if (haystack.length < needle.length) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
for (let i = 0; i < needle.length; i++) {
|
|
11
|
+
if (haystack[i] !== needle[i]) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Determines if haystack ends with needle.
|
|
19
|
+
*/
|
|
20
|
+
export function endsWith(haystack, needle) {
|
|
21
|
+
let diff = haystack.length - needle.length;
|
|
22
|
+
if (diff > 0) {
|
|
23
|
+
return haystack.lastIndexOf(needle) === diff;
|
|
24
|
+
}
|
|
25
|
+
else if (diff === 0) {
|
|
26
|
+
return haystack === needle;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Computes the difference score for two strings. More similar strings have a higher score.
|
|
34
|
+
* We use largest common subsequence dynamic programming approach but penalize in the end for length differences.
|
|
35
|
+
* Strings that have a large length difference will get a bad default score 0.
|
|
36
|
+
* Complexity - both time and space O(first.length * second.length)
|
|
37
|
+
* Dynamic programming LCS computation http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
|
|
38
|
+
*
|
|
39
|
+
* @param first a string
|
|
40
|
+
* @param second a string
|
|
41
|
+
*/
|
|
42
|
+
export function difference(first, second, maxLenDelta = 4) {
|
|
43
|
+
let lengthDifference = Math.abs(first.length - second.length);
|
|
44
|
+
// We only compute score if length of the currentWord and length of entry.name are similar.
|
|
45
|
+
if (lengthDifference > maxLenDelta) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
// Initialize LCS (largest common subsequence) matrix.
|
|
49
|
+
let LCS = [];
|
|
50
|
+
let zeroArray = [];
|
|
51
|
+
let i, j;
|
|
52
|
+
for (i = 0; i < second.length + 1; ++i) {
|
|
53
|
+
zeroArray.push(0);
|
|
54
|
+
}
|
|
55
|
+
for (i = 0; i < first.length + 1; ++i) {
|
|
56
|
+
LCS.push(zeroArray);
|
|
57
|
+
}
|
|
58
|
+
for (i = 1; i < first.length + 1; ++i) {
|
|
59
|
+
for (j = 1; j < second.length + 1; ++j) {
|
|
60
|
+
if (first[i - 1] === second[j - 1]) {
|
|
61
|
+
LCS[i][j] = LCS[i - 1][j - 1] + 1;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
LCS[i][j] = Math.max(LCS[i - 1][j], LCS[i][j - 1]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return LCS[first.length][second.length] - Math.sqrt(lengthDifference);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Limit of string length.
|
|
72
|
+
*/
|
|
73
|
+
export function getLimitedString(str, ellipsis = true) {
|
|
74
|
+
if (!str) {
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
if (str.length < 140) {
|
|
78
|
+
return str;
|
|
79
|
+
}
|
|
80
|
+
return str.slice(0, 140) + (ellipsis ? '\u2026' : '');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Limit of string length.
|
|
84
|
+
*/
|
|
85
|
+
export function trim(str, regexp) {
|
|
86
|
+
const m = regexp.exec(str);
|
|
87
|
+
if (m && m[0].length) {
|
|
88
|
+
return str.substr(0, str.length - m[0].length);
|
|
89
|
+
}
|
|
90
|
+
return str;
|
|
91
|
+
}
|
|
92
|
+
export function repeat(value, count) {
|
|
93
|
+
let s = '';
|
|
94
|
+
while (count > 0) {
|
|
95
|
+
if ((count & 1) === 1) {
|
|
96
|
+
s += value;
|
|
97
|
+
}
|
|
98
|
+
value += value;
|
|
99
|
+
count = count >>> 1;
|
|
100
|
+
}
|
|
101
|
+
return s;
|
|
102
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// copied from js-beautify/js/lib/beautify-css.js
|
|
2
|
-
// version: 1.14.
|
|
2
|
+
// version: 1.14.3
|
|
3
3
|
/* AUTO-GENERATED. DO NOT MODIFY. */
|
|
4
4
|
/*
|
|
5
5
|
|
|
@@ -1092,6 +1092,9 @@ function Beautifier(source_text, options) {
|
|
|
1092
1092
|
"@supports": true,
|
|
1093
1093
|
"@document": true
|
|
1094
1094
|
};
|
|
1095
|
+
this.NON_SEMICOLON_NEWLINE_PROPERTY = [
|
|
1096
|
+
"grid-template"
|
|
1097
|
+
];
|
|
1095
1098
|
|
|
1096
1099
|
}
|
|
1097
1100
|
|
|
@@ -1216,7 +1219,9 @@ Beautifier.prototype.beautify = function() {
|
|
|
1216
1219
|
var enteringConditionalGroup = false;
|
|
1217
1220
|
var insideAtExtend = false;
|
|
1218
1221
|
var insideAtImport = false;
|
|
1222
|
+
var insideScssMap = false;
|
|
1219
1223
|
var topCharacter = this._ch;
|
|
1224
|
+
var insideNonSemiColonValues = false;
|
|
1220
1225
|
var whitespace;
|
|
1221
1226
|
var isAfterSpace;
|
|
1222
1227
|
var previous_ch;
|
|
@@ -1268,7 +1273,7 @@ Beautifier.prototype.beautify = function() {
|
|
|
1268
1273
|
|
|
1269
1274
|
// Ensures any new lines following the comment are preserved
|
|
1270
1275
|
this.eatWhitespace(true);
|
|
1271
|
-
} else if (this._ch === '@') {
|
|
1276
|
+
} else if (this._ch === '@' || this._ch === '$') {
|
|
1272
1277
|
this.preserveSingleSpace(isAfterSpace);
|
|
1273
1278
|
|
|
1274
1279
|
// deal with less propery mixins @{...}
|
|
@@ -1339,7 +1344,12 @@ Beautifier.prototype.beautify = function() {
|
|
|
1339
1344
|
this.indent();
|
|
1340
1345
|
this._output.set_indent(this._indentLevel);
|
|
1341
1346
|
} else {
|
|
1342
|
-
|
|
1347
|
+
// inside mixin and first param is object
|
|
1348
|
+
if (previous_ch === '(') {
|
|
1349
|
+
this._output.space_before_token = false;
|
|
1350
|
+
} else if (previous_ch !== ',') {
|
|
1351
|
+
this.indent();
|
|
1352
|
+
}
|
|
1343
1353
|
this.print_string(this._ch);
|
|
1344
1354
|
}
|
|
1345
1355
|
|
|
@@ -1371,7 +1381,21 @@ Beautifier.prototype.beautify = function() {
|
|
|
1371
1381
|
this._output.add_new_line(true);
|
|
1372
1382
|
}
|
|
1373
1383
|
}
|
|
1384
|
+
if (this._input.peek() === ')') {
|
|
1385
|
+
this._output.trim(true);
|
|
1386
|
+
if (this._options.brace_style === "expand") {
|
|
1387
|
+
this._output.add_new_line(true);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1374
1390
|
} else if (this._ch === ":") {
|
|
1391
|
+
|
|
1392
|
+
for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) {
|
|
1393
|
+
if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) {
|
|
1394
|
+
insideNonSemiColonValues = true;
|
|
1395
|
+
break;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1375
1399
|
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
|
|
1376
1400
|
// 'property: value' delimiter
|
|
1377
1401
|
// which could be in a conditional group query
|
|
@@ -1404,6 +1428,7 @@ Beautifier.prototype.beautify = function() {
|
|
|
1404
1428
|
this.print_string(this._ch + this.eatString(this._ch));
|
|
1405
1429
|
this.eatWhitespace(true);
|
|
1406
1430
|
} else if (this._ch === ';') {
|
|
1431
|
+
insideNonSemiColonValues = false;
|
|
1407
1432
|
if (parenLevel === 0) {
|
|
1408
1433
|
if (insidePropertyValue) {
|
|
1409
1434
|
this.outdent();
|
|
@@ -1445,20 +1470,32 @@ Beautifier.prototype.beautify = function() {
|
|
|
1445
1470
|
} else {
|
|
1446
1471
|
this.preserveSingleSpace(isAfterSpace);
|
|
1447
1472
|
this.print_string(this._ch);
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
this.
|
|
1473
|
+
|
|
1474
|
+
// handle scss/sass map
|
|
1475
|
+
if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) {
|
|
1476
|
+
this._output.add_new_line();
|
|
1477
|
+
insideScssMap = true;
|
|
1478
|
+
} else {
|
|
1479
|
+
this.eatWhitespace();
|
|
1480
|
+
parenLevel++;
|
|
1481
|
+
this.indent();
|
|
1482
|
+
}
|
|
1451
1483
|
}
|
|
1452
1484
|
} else if (this._ch === ')') {
|
|
1453
1485
|
if (parenLevel) {
|
|
1454
1486
|
parenLevel--;
|
|
1455
1487
|
this.outdent();
|
|
1456
1488
|
}
|
|
1489
|
+
if (insideScssMap && this._input.peek() === ";" && this._options.selector_separator_newline) {
|
|
1490
|
+
insideScssMap = false;
|
|
1491
|
+
this.outdent();
|
|
1492
|
+
this._output.add_new_line();
|
|
1493
|
+
}
|
|
1457
1494
|
this.print_string(this._ch);
|
|
1458
1495
|
} else if (this._ch === ',') {
|
|
1459
1496
|
this.print_string(this._ch);
|
|
1460
1497
|
this.eatWhitespace(true);
|
|
1461
|
-
if (this._options.selector_separator_newline && !insidePropertyValue && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
|
|
1498
|
+
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
|
|
1462
1499
|
this._output.add_new_line();
|
|
1463
1500
|
} else {
|
|
1464
1501
|
this._output.space_before_token = true;
|
|
@@ -1492,8 +1529,13 @@ Beautifier.prototype.beautify = function() {
|
|
|
1492
1529
|
this.print_string(' ');
|
|
1493
1530
|
this.print_string(this._ch);
|
|
1494
1531
|
} else {
|
|
1495
|
-
|
|
1532
|
+
var preserveAfterSpace = previous_ch === '"' || previous_ch === '\'';
|
|
1533
|
+
this.preserveSingleSpace(preserveAfterSpace || isAfterSpace);
|
|
1496
1534
|
this.print_string(this._ch);
|
|
1535
|
+
|
|
1536
|
+
if (!this._output.just_added_newline() && this._input.peek() === '\n' && insideNonSemiColonValues) {
|
|
1537
|
+
this._output.add_new_line();
|
|
1538
|
+
}
|
|
1497
1539
|
}
|
|
1498
1540
|
}
|
|
1499
1541
|
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1, HoverSettings, CompletionSettings, TextEdit, CSSFormatConfiguration } from './cssLanguageTypes';
|
|
2
|
-
export declare type Stylesheet = {};
|
|
3
|
-
export * from './cssLanguageTypes';
|
|
4
|
-
export interface LanguageService {
|
|
5
|
-
configure(raw?: LanguageSettings): void;
|
|
6
|
-
setDataProviders(useDefaultDataProvider: boolean, customDataProviders: ICSSDataProvider[]): void;
|
|
7
|
-
doValidation(document: TextDocument, stylesheet: Stylesheet, documentSettings?: LanguageSettings): Diagnostic[];
|
|
8
|
-
parseStylesheet(document: TextDocument): Stylesheet;
|
|
9
|
-
doComplete(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: CompletionSettings): CompletionList;
|
|
10
|
-
doComplete2(document: TextDocument, position: Position, stylesheet: Stylesheet, documentContext: DocumentContext, settings?: CompletionSettings): Promise<CompletionList>;
|
|
11
|
-
setCompletionParticipants(registeredCompletionParticipants: ICompletionParticipant[]): void;
|
|
12
|
-
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: HoverSettings): Hover | null;
|
|
13
|
-
findDefinition(document: TextDocument, position: Position, stylesheet: Stylesheet): Location | null;
|
|
14
|
-
findReferences(document: TextDocument, position: Position, stylesheet: Stylesheet): Location[];
|
|
15
|
-
findDocumentHighlights(document: TextDocument, position: Position, stylesheet: Stylesheet): DocumentHighlight[];
|
|
16
|
-
findDocumentLinks(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): DocumentLink[];
|
|
17
|
-
/**
|
|
18
|
-
* Return statically resolved links, and dynamically resolved links if `fsProvider` is proved.
|
|
19
|
-
*/
|
|
20
|
-
findDocumentLinks2(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): Promise<DocumentLink[]>;
|
|
21
|
-
findDocumentSymbols(document: TextDocument, stylesheet: Stylesheet): SymbolInformation[];
|
|
22
|
-
doCodeActions(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): Command[];
|
|
23
|
-
doCodeActions2(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): CodeAction[];
|
|
24
|
-
findDocumentColors(document: TextDocument, stylesheet: Stylesheet): ColorInformation[];
|
|
25
|
-
getColorPresentations(document: TextDocument, stylesheet: Stylesheet, color: Color, range: Range): ColorPresentation[];
|
|
26
|
-
doRename(document: TextDocument, position: Position, newName: string, stylesheet: Stylesheet): WorkspaceEdit;
|
|
27
|
-
getFoldingRanges(document: TextDocument, context?: {
|
|
28
|
-
rangeLimit?: number;
|
|
29
|
-
}): FoldingRange[];
|
|
30
|
-
getSelectionRanges(document: TextDocument, positions: Position[], stylesheet: Stylesheet): SelectionRange[];
|
|
31
|
-
format(document: TextDocument, range: Range | undefined, options: CSSFormatConfiguration): TextEdit[];
|
|
32
|
-
}
|
|
33
|
-
export declare function getDefaultCSSDataProvider(): ICSSDataProvider;
|
|
34
|
-
export declare function newCSSDataProvider(data: CSSDataV1): ICSSDataProvider;
|
|
35
|
-
export declare function getCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
36
|
-
export declare function getSCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
37
|
-
export declare function getLESSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
1
|
+
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1, HoverSettings, CompletionSettings, TextEdit, CSSFormatConfiguration } from './cssLanguageTypes';
|
|
2
|
+
export declare type Stylesheet = {};
|
|
3
|
+
export * from './cssLanguageTypes';
|
|
4
|
+
export interface LanguageService {
|
|
5
|
+
configure(raw?: LanguageSettings): void;
|
|
6
|
+
setDataProviders(useDefaultDataProvider: boolean, customDataProviders: ICSSDataProvider[]): void;
|
|
7
|
+
doValidation(document: TextDocument, stylesheet: Stylesheet, documentSettings?: LanguageSettings): Diagnostic[];
|
|
8
|
+
parseStylesheet(document: TextDocument): Stylesheet;
|
|
9
|
+
doComplete(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: CompletionSettings): CompletionList;
|
|
10
|
+
doComplete2(document: TextDocument, position: Position, stylesheet: Stylesheet, documentContext: DocumentContext, settings?: CompletionSettings): Promise<CompletionList>;
|
|
11
|
+
setCompletionParticipants(registeredCompletionParticipants: ICompletionParticipant[]): void;
|
|
12
|
+
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: HoverSettings): Hover | null;
|
|
13
|
+
findDefinition(document: TextDocument, position: Position, stylesheet: Stylesheet): Location | null;
|
|
14
|
+
findReferences(document: TextDocument, position: Position, stylesheet: Stylesheet): Location[];
|
|
15
|
+
findDocumentHighlights(document: TextDocument, position: Position, stylesheet: Stylesheet): DocumentHighlight[];
|
|
16
|
+
findDocumentLinks(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): DocumentLink[];
|
|
17
|
+
/**
|
|
18
|
+
* Return statically resolved links, and dynamically resolved links if `fsProvider` is proved.
|
|
19
|
+
*/
|
|
20
|
+
findDocumentLinks2(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): Promise<DocumentLink[]>;
|
|
21
|
+
findDocumentSymbols(document: TextDocument, stylesheet: Stylesheet): SymbolInformation[];
|
|
22
|
+
doCodeActions(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): Command[];
|
|
23
|
+
doCodeActions2(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): CodeAction[];
|
|
24
|
+
findDocumentColors(document: TextDocument, stylesheet: Stylesheet): ColorInformation[];
|
|
25
|
+
getColorPresentations(document: TextDocument, stylesheet: Stylesheet, color: Color, range: Range): ColorPresentation[];
|
|
26
|
+
doRename(document: TextDocument, position: Position, newName: string, stylesheet: Stylesheet): WorkspaceEdit;
|
|
27
|
+
getFoldingRanges(document: TextDocument, context?: {
|
|
28
|
+
rangeLimit?: number;
|
|
29
|
+
}): FoldingRange[];
|
|
30
|
+
getSelectionRanges(document: TextDocument, positions: Position[], stylesheet: Stylesheet): SelectionRange[];
|
|
31
|
+
format(document: TextDocument, range: Range | undefined, options: CSSFormatConfiguration): TextEdit[];
|
|
32
|
+
}
|
|
33
|
+
export declare function getDefaultCSSDataProvider(): ICSSDataProvider;
|
|
34
|
+
export declare function newCSSDataProvider(data: CSSDataV1): ICSSDataProvider;
|
|
35
|
+
export declare function getCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
36
|
+
export declare function getSCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
37
|
+
export declare function getLESSLanguageService(options?: LanguageServiceOptions): LanguageService;
|