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
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
'use strict';
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.getSelectionRanges = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const cssLanguageTypes_1 = require("../cssLanguageTypes");
|
|
18
|
+
const cssNodes_1 = require("../parser/cssNodes");
|
|
19
19
|
function getSelectionRanges(document, positions, stylesheet) {
|
|
20
20
|
function getSelectionRange(position) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
for (
|
|
21
|
+
const applicableRanges = getApplicableRanges(position);
|
|
22
|
+
let current = undefined;
|
|
23
|
+
for (let index = applicableRanges.length - 1; index >= 0; index--) {
|
|
24
24
|
current = cssLanguageTypes_1.SelectionRange.create(cssLanguageTypes_1.Range.create(document.positionAt(applicableRanges[index][0]), document.positionAt(applicableRanges[index][1])), current);
|
|
25
25
|
}
|
|
26
26
|
if (!current) {
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
}
|
|
31
31
|
return positions.map(getSelectionRange);
|
|
32
32
|
function getApplicableRanges(position) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const offset = document.offsetAt(position);
|
|
34
|
+
let currNode = stylesheet.findChildAtOffset(offset, true);
|
|
35
35
|
if (!currNode) {
|
|
36
36
|
return [];
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const result = [];
|
|
39
39
|
while (currNode) {
|
|
40
40
|
if (currNode.parent &&
|
|
41
41
|
currNode.offset === currNode.parent.offset &&
|
|
@@ -14,32 +14,31 @@
|
|
|
14
14
|
'use strict';
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.CSSValidation = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const nodes = require("../parser/cssNodes");
|
|
18
|
+
const lintRules_1 = require("./lintRules");
|
|
19
|
+
const lint_1 = require("./lint");
|
|
20
|
+
const cssLanguageTypes_1 = require("../cssLanguageTypes");
|
|
21
|
+
class CSSValidation {
|
|
22
|
+
constructor(cssDataManager) {
|
|
23
23
|
this.cssDataManager = cssDataManager;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
configure(settings) {
|
|
26
26
|
this.settings = settings;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (settings === void 0) { settings = this.settings; }
|
|
27
|
+
}
|
|
28
|
+
doValidation(document, stylesheet, settings = this.settings) {
|
|
30
29
|
if (settings && settings.validate === false) {
|
|
31
30
|
return [];
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
const entries = [];
|
|
34
33
|
entries.push.apply(entries, nodes.ParseErrorCollector.entries(stylesheet));
|
|
35
34
|
entries.push.apply(entries, lint_1.LintVisitor.entries(stylesheet, document, new lintRules_1.LintConfigurationSettings(settings && settings.lint), this.cssDataManager));
|
|
36
|
-
|
|
37
|
-
for (
|
|
35
|
+
const ruleIds = [];
|
|
36
|
+
for (const r in lintRules_1.Rules) {
|
|
38
37
|
ruleIds.push(lintRules_1.Rules[r].id);
|
|
39
38
|
}
|
|
40
39
|
function toDiagnostic(marker) {
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const range = cssLanguageTypes_1.Range.create(document.positionAt(marker.getOffset()), document.positionAt(marker.getOffset() + marker.getLength()));
|
|
41
|
+
const source = document.languageId;
|
|
43
42
|
return {
|
|
44
43
|
code: marker.getRule().id,
|
|
45
44
|
source: source,
|
|
@@ -48,9 +47,8 @@
|
|
|
48
47
|
range: range
|
|
49
48
|
};
|
|
50
49
|
}
|
|
51
|
-
return entries.filter(
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
}());
|
|
50
|
+
return entries.filter(entry => entry.getLevel() !== nodes.Level.Ignore).map(toDiagnostic);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
55
53
|
exports.CSSValidation = CSSValidation;
|
|
56
54
|
});
|