vscode-css-languageservice 5.4.2 → 6.1.0
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 +7 -1
- package/SECURITY.md +41 -0
- package/lib/esm/beautify/beautify-css.js +11 -4
- package/lib/esm/cssLanguageService.d.ts +2 -1
- package/lib/esm/cssLanguageService.js +15 -17
- package/lib/esm/cssLanguageTypes.js +2 -2
- package/lib/esm/data/webCustomData.js +356 -232
- package/lib/esm/languageFacts/builtinData.js +15 -15
- package/lib/esm/languageFacts/colors.js +66 -69
- package/lib/esm/languageFacts/dataManager.js +38 -42
- package/lib/esm/languageFacts/dataProvider.js +17 -23
- package/lib/esm/languageFacts/entry.js +22 -23
- package/lib/esm/parser/cssErrors.js +5 -7
- package/lib/esm/parser/cssNodes.js +869 -1377
- package/lib/esm/parser/cssParser.js +419 -376
- package/lib/esm/parser/cssScanner.js +168 -175
- package/lib/esm/parser/cssSymbolScope.js +107 -137
- package/lib/esm/parser/lessParser.js +177 -202
- package/lib/esm/parser/lessScanner.js +22 -43
- package/lib/esm/parser/scssErrors.js +5 -7
- package/lib/esm/parser/scssParser.js +196 -208
- package/lib/esm/parser/scssScanner.js +33 -54
- package/lib/esm/services/cssCodeActions.js +36 -40
- package/lib/esm/services/cssCompletion.js +300 -395
- package/lib/esm/services/cssFolding.js +32 -35
- package/lib/esm/services/cssFormatter.js +22 -22
- package/lib/esm/services/cssHover.js +30 -33
- package/lib/esm/services/cssNavigation.js +260 -289
- package/lib/esm/services/cssSelectionRange.js +6 -6
- package/lib/esm/services/cssValidation.js +13 -16
- package/lib/esm/services/lessCompletion.js +351 -370
- package/lib/esm/services/lint.js +161 -175
- package/lib/esm/services/lintRules.js +20 -27
- package/lib/esm/services/lintUtil.js +19 -28
- package/lib/esm/services/pathCompletion.js +84 -158
- package/lib/esm/services/scssCompletion.js +283 -307
- package/lib/esm/services/scssNavigation.js +65 -137
- package/lib/esm/services/selectorPrinting.js +131 -175
- package/lib/esm/utils/arrays.js +6 -12
- package/lib/esm/utils/objects.js +1 -1
- package/lib/esm/utils/resources.js +3 -16
- package/lib/esm/utils/strings.js +10 -12
- package/lib/umd/beautify/beautify-css.js +11 -4
- package/lib/umd/cssLanguageService.d.ts +2 -1
- package/lib/umd/cssLanguageService.js +34 -32
- package/lib/umd/cssLanguageTypes.js +4 -3
- package/lib/umd/data/webCustomData.js +355 -231
- package/lib/umd/languageFacts/colors.js +65 -68
- package/lib/umd/languageFacts/dataManager.js +41 -44
- package/lib/umd/languageFacts/dataProvider.js +17 -22
- package/lib/umd/languageFacts/entry.js +22 -23
- package/lib/umd/languageFacts/facts.js +5 -1
- package/lib/umd/parser/cssErrors.js +5 -6
- package/lib/umd/parser/cssNodes.js +870 -1307
- package/lib/umd/parser/cssParser.js +424 -380
- package/lib/umd/parser/cssScanner.js +168 -173
- package/lib/umd/parser/cssSymbolScope.js +109 -134
- package/lib/umd/parser/lessParser.js +182 -206
- package/lib/umd/parser/lessScanner.js +22 -42
- package/lib/umd/parser/scssErrors.js +5 -6
- package/lib/umd/parser/scssParser.js +202 -213
- package/lib/umd/parser/scssScanner.js +25 -45
- package/lib/umd/services/cssCodeActions.js +41 -44
- package/lib/umd/services/cssCompletion.js +308 -402
- package/lib/umd/services/cssFolding.js +35 -38
- package/lib/umd/services/cssFormatter.js +25 -25
- package/lib/umd/services/cssHover.js +36 -38
- package/lib/umd/services/cssNavigation.js +267 -295
- package/lib/umd/services/cssSelectionRange.js +8 -8
- package/lib/umd/services/cssValidation.js +17 -19
- package/lib/umd/services/lessCompletion.js +354 -372
- package/lib/umd/services/lint.js +167 -180
- package/lib/umd/services/lintRules.js +20 -24
- package/lib/umd/services/lintUtil.js +20 -28
- package/lib/umd/services/pathCompletion.js +87 -160
- package/lib/umd/services/scssCompletion.js +287 -310
- package/lib/umd/services/scssNavigation.js +69 -140
- package/lib/umd/services/selectorPrinting.js +134 -174
- package/lib/umd/utils/arrays.js +6 -12
- package/lib/umd/utils/objects.js +1 -1
- package/lib/umd/utils/resources.js +4 -17
- package/lib/umd/utils/strings.js +10 -12
- package/package.json +16 -15
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
'use strict';
|
|
6
6
|
import { MarkupKind } from '../cssLanguageTypes';
|
|
7
|
-
export
|
|
7
|
+
export const browserNames = {
|
|
8
8
|
E: 'Edge',
|
|
9
9
|
FF: 'Firefox',
|
|
10
10
|
S: 'Safari',
|
|
@@ -25,7 +25,7 @@ function getEntryStatus(status) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
export function getEntryDescription(entry, doesSupportMarkdown, settings) {
|
|
28
|
-
|
|
28
|
+
let result;
|
|
29
29
|
if (doesSupportMarkdown) {
|
|
30
30
|
result = {
|
|
31
31
|
kind: 'markdown',
|
|
@@ -54,26 +54,26 @@ function getEntryStringDescription(entry, settings) {
|
|
|
54
54
|
if (typeof entry.description !== 'string') {
|
|
55
55
|
return entry.description.value;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
if (
|
|
57
|
+
let result = '';
|
|
58
|
+
if (settings?.documentation !== false) {
|
|
59
59
|
if (entry.status) {
|
|
60
60
|
result += getEntryStatus(entry.status);
|
|
61
61
|
}
|
|
62
62
|
result += entry.description;
|
|
63
|
-
|
|
63
|
+
const browserLabel = getBrowserLabel(entry.browsers);
|
|
64
64
|
if (browserLabel) {
|
|
65
65
|
result += '\n(' + browserLabel + ')';
|
|
66
66
|
}
|
|
67
67
|
if ('syntax' in entry) {
|
|
68
|
-
result +=
|
|
68
|
+
result += `\n\nSyntax: ${entry.syntax}`;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
if (entry.references && entry.references.length > 0 &&
|
|
71
|
+
if (entry.references && entry.references.length > 0 && settings?.references !== false) {
|
|
72
72
|
if (result.length > 0) {
|
|
73
73
|
result += '\n\n';
|
|
74
74
|
}
|
|
75
|
-
result += entry.references.map(
|
|
76
|
-
return
|
|
75
|
+
result += entry.references.map(r => {
|
|
76
|
+
return `${r.name}: ${r.url}`;
|
|
77
77
|
}).join(' | ');
|
|
78
78
|
}
|
|
79
79
|
return result;
|
|
@@ -82,8 +82,8 @@ function getEntryMarkdownDescription(entry, settings) {
|
|
|
82
82
|
if (!entry.description || entry.description === '') {
|
|
83
83
|
return '';
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
if (
|
|
85
|
+
let result = '';
|
|
86
|
+
if (settings?.documentation !== false) {
|
|
87
87
|
if (entry.status) {
|
|
88
88
|
result += getEntryStatus(entry.status);
|
|
89
89
|
}
|
|
@@ -93,20 +93,20 @@ function getEntryMarkdownDescription(entry, settings) {
|
|
|
93
93
|
else {
|
|
94
94
|
result += entry.description.kind === MarkupKind.Markdown ? entry.description.value : textToMarkedString(entry.description.value);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
const browserLabel = getBrowserLabel(entry.browsers);
|
|
97
97
|
if (browserLabel) {
|
|
98
98
|
result += '\n\n(' + textToMarkedString(browserLabel) + ')';
|
|
99
99
|
}
|
|
100
100
|
if ('syntax' in entry && entry.syntax) {
|
|
101
|
-
result +=
|
|
101
|
+
result += `\n\nSyntax: ${textToMarkedString(entry.syntax)}`;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
if (entry.references && entry.references.length > 0 &&
|
|
104
|
+
if (entry.references && entry.references.length > 0 && settings?.references !== false) {
|
|
105
105
|
if (result.length > 0) {
|
|
106
106
|
result += '\n\n';
|
|
107
107
|
}
|
|
108
|
-
result += entry.references.map(
|
|
109
|
-
return
|
|
108
|
+
result += entry.references.map(r => {
|
|
109
|
+
return `[${r.name}](${r.url})`;
|
|
110
110
|
}).join(' | ');
|
|
111
111
|
}
|
|
112
112
|
return result;
|
|
@@ -115,17 +115,16 @@ function getEntryMarkdownDescription(entry, settings) {
|
|
|
115
115
|
* Input is like `["E12","FF49","C47","IE","O"]`
|
|
116
116
|
* Output is like `Edge 12, Firefox 49, Chrome 47, IE, Opera`
|
|
117
117
|
*/
|
|
118
|
-
export function getBrowserLabel(browsers) {
|
|
119
|
-
if (browsers === void 0) { browsers = []; }
|
|
118
|
+
export function getBrowserLabel(browsers = []) {
|
|
120
119
|
if (browsers.length === 0) {
|
|
121
120
|
return null;
|
|
122
121
|
}
|
|
123
122
|
return browsers
|
|
124
|
-
.map(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
.map(b => {
|
|
124
|
+
let result = '';
|
|
125
|
+
const matches = b.match(/([A-Z]+)(\d+)?/);
|
|
126
|
+
const name = matches[1];
|
|
127
|
+
const version = matches[2];
|
|
129
128
|
if (name in browserNames) {
|
|
130
129
|
result += browserNames[name];
|
|
131
130
|
}
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
'use strict';
|
|
6
6
|
import * as nls from 'vscode-nls';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const localize = nls.loadMessageBundle();
|
|
8
|
+
export class CSSIssueType {
|
|
9
|
+
constructor(id, message) {
|
|
10
10
|
this.id = id;
|
|
11
11
|
this.message = message;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export { CSSIssueType };
|
|
16
|
-
export var ParseError = {
|
|
13
|
+
}
|
|
14
|
+
export const ParseError = {
|
|
17
15
|
NumberExpected: new CSSIssueType('css-numberexpected', localize('expected.number', "number expected")),
|
|
18
16
|
ConditionExpected: new CSSIssueType('css-conditionexpected', localize('expected.condt', "condition expected")),
|
|
19
17
|
RuleOrSelectorExpected: new CSSIssueType('css-ruleorselectorexpected', localize('expected.ruleorselector', "at-rule or selector expected")),
|