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
|
@@ -7,9 +7,9 @@ import { Range, SelectionRange } from '../cssLanguageTypes';
|
|
|
7
7
|
import { NodeType } from '../parser/cssNodes';
|
|
8
8
|
export function getSelectionRanges(document, positions, stylesheet) {
|
|
9
9
|
function getSelectionRange(position) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (
|
|
10
|
+
const applicableRanges = getApplicableRanges(position);
|
|
11
|
+
let current = undefined;
|
|
12
|
+
for (let index = applicableRanges.length - 1; index >= 0; index--) {
|
|
13
13
|
current = SelectionRange.create(Range.create(document.positionAt(applicableRanges[index][0]), document.positionAt(applicableRanges[index][1])), current);
|
|
14
14
|
}
|
|
15
15
|
if (!current) {
|
|
@@ -19,12 +19,12 @@ export function getSelectionRanges(document, positions, stylesheet) {
|
|
|
19
19
|
}
|
|
20
20
|
return positions.map(getSelectionRange);
|
|
21
21
|
function getApplicableRanges(position) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const offset = document.offsetAt(position);
|
|
23
|
+
let currNode = stylesheet.findChildAtOffset(offset, true);
|
|
24
24
|
if (!currNode) {
|
|
25
25
|
return [];
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const result = [];
|
|
28
28
|
while (currNode) {
|
|
29
29
|
if (currNode.parent &&
|
|
30
30
|
currNode.offset === currNode.parent.offset &&
|
|
@@ -7,28 +7,27 @@ import * as nodes from '../parser/cssNodes';
|
|
|
7
7
|
import { LintConfigurationSettings, Rules } from './lintRules';
|
|
8
8
|
import { LintVisitor } from './lint';
|
|
9
9
|
import { Range, DiagnosticSeverity } from '../cssLanguageTypes';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export class CSSValidation {
|
|
11
|
+
constructor(cssDataManager) {
|
|
12
12
|
this.cssDataManager = cssDataManager;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
configure(settings) {
|
|
15
15
|
this.settings = settings;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (settings === void 0) { settings = this.settings; }
|
|
16
|
+
}
|
|
17
|
+
doValidation(document, stylesheet, settings = this.settings) {
|
|
19
18
|
if (settings && settings.validate === false) {
|
|
20
19
|
return [];
|
|
21
20
|
}
|
|
22
|
-
|
|
21
|
+
const entries = [];
|
|
23
22
|
entries.push.apply(entries, nodes.ParseErrorCollector.entries(stylesheet));
|
|
24
23
|
entries.push.apply(entries, LintVisitor.entries(stylesheet, document, new LintConfigurationSettings(settings && settings.lint), this.cssDataManager));
|
|
25
|
-
|
|
26
|
-
for (
|
|
24
|
+
const ruleIds = [];
|
|
25
|
+
for (const r in Rules) {
|
|
27
26
|
ruleIds.push(Rules[r].id);
|
|
28
27
|
}
|
|
29
28
|
function toDiagnostic(marker) {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const range = Range.create(document.positionAt(marker.getOffset()), document.positionAt(marker.getOffset() + marker.getLength()));
|
|
30
|
+
const source = document.languageId;
|
|
32
31
|
return {
|
|
33
32
|
code: marker.getRule().id,
|
|
34
33
|
source: source,
|
|
@@ -37,8 +36,6 @@ var CSSValidation = /** @class */ (function () {
|
|
|
37
36
|
range: range
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
|
-
return entries.filter(
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}());
|
|
44
|
-
export { CSSValidation };
|
|
39
|
+
return entries.filter(entry => entry.getLevel() !== nodes.Level.Ignore).map(toDiagnostic);
|
|
40
|
+
}
|
|
41
|
+
}
|