vscode-css-languageservice 5.4.2 → 6.0.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/lib/esm/cssLanguageService.d.ts +37 -37
  3. package/lib/esm/cssLanguageService.js +72 -75
  4. package/lib/esm/cssLanguageTypes.d.ts +238 -238
  5. package/lib/esm/cssLanguageTypes.js +42 -42
  6. package/lib/esm/data/webCustomData.js +21965 -21965
  7. package/lib/esm/languageFacts/builtinData.js +142 -142
  8. package/lib/esm/languageFacts/colors.js +469 -472
  9. package/lib/esm/languageFacts/dataManager.js +88 -92
  10. package/lib/esm/languageFacts/dataProvider.js +73 -79
  11. package/lib/esm/languageFacts/entry.js +137 -138
  12. package/lib/esm/languageFacts/facts.js +8 -8
  13. package/lib/esm/parser/cssErrors.js +48 -50
  14. package/lib/esm/parser/cssNodes.js +1502 -2019
  15. package/lib/esm/parser/cssParser.js +1534 -1563
  16. package/lib/esm/parser/cssScanner.js +592 -599
  17. package/lib/esm/parser/cssSymbolScope.js +311 -341
  18. package/lib/esm/parser/lessParser.js +714 -740
  19. package/lib/esm/parser/lessScanner.js +57 -78
  20. package/lib/esm/parser/scssErrors.js +18 -20
  21. package/lib/esm/parser/scssParser.js +796 -818
  22. package/lib/esm/parser/scssScanner.js +95 -116
  23. package/lib/esm/services/cssCodeActions.js +77 -81
  24. package/lib/esm/services/cssCompletion.js +1054 -1149
  25. package/lib/esm/services/cssFolding.js +190 -193
  26. package/lib/esm/services/cssFormatter.js +136 -136
  27. package/lib/esm/services/cssHover.js +148 -151
  28. package/lib/esm/services/cssNavigation.js +378 -470
  29. package/lib/esm/services/cssSelectionRange.js +47 -47
  30. package/lib/esm/services/cssValidation.js +41 -44
  31. package/lib/esm/services/lessCompletion.js +378 -397
  32. package/lib/esm/services/lint.js +518 -532
  33. package/lib/esm/services/lintRules.js +76 -83
  34. package/lib/esm/services/lintUtil.js +196 -205
  35. package/lib/esm/services/pathCompletion.js +157 -231
  36. package/lib/esm/services/scssCompletion.js +354 -378
  37. package/lib/esm/services/scssNavigation.js +82 -154
  38. package/lib/esm/services/selectorPrinting.js +492 -536
  39. package/lib/esm/utils/arrays.js +40 -46
  40. package/lib/esm/utils/objects.js +11 -11
  41. package/lib/esm/utils/resources.js +11 -24
  42. package/lib/esm/utils/strings.js +102 -104
  43. package/lib/umd/cssLanguageService.d.ts +37 -37
  44. package/lib/umd/cssLanguageService.js +99 -102
  45. package/lib/umd/cssLanguageTypes.d.ts +238 -238
  46. package/lib/umd/cssLanguageTypes.js +89 -88
  47. package/lib/umd/data/webCustomData.js +21978 -21978
  48. package/lib/umd/languageFacts/builtinData.js +154 -154
  49. package/lib/umd/languageFacts/colors.js +492 -495
  50. package/lib/umd/languageFacts/dataManager.js +101 -104
  51. package/lib/umd/languageFacts/dataProvider.js +86 -91
  52. package/lib/umd/languageFacts/entry.js +152 -153
  53. package/lib/umd/languageFacts/facts.js +29 -29
  54. package/lib/umd/parser/cssErrors.js +61 -62
  55. package/lib/umd/parser/cssNodes.js +1587 -2034
  56. package/lib/umd/parser/cssParser.js +1547 -1575
  57. package/lib/umd/parser/cssScanner.js +606 -611
  58. package/lib/umd/parser/cssSymbolScope.js +328 -353
  59. package/lib/umd/parser/lessParser.js +727 -752
  60. package/lib/umd/parser/lessScanner.js +70 -90
  61. package/lib/umd/parser/scssErrors.js +31 -32
  62. package/lib/umd/parser/scssParser.js +809 -830
  63. package/lib/umd/parser/scssScanner.js +108 -128
  64. package/lib/umd/services/cssCodeActions.js +90 -93
  65. package/lib/umd/services/cssCompletion.js +1067 -1161
  66. package/lib/umd/services/cssFolding.js +203 -206
  67. package/lib/umd/services/cssFormatter.js +150 -150
  68. package/lib/umd/services/cssHover.js +161 -163
  69. package/lib/umd/services/cssNavigation.js +391 -482
  70. package/lib/umd/services/cssSelectionRange.js +60 -60
  71. package/lib/umd/services/cssValidation.js +54 -56
  72. package/lib/umd/services/lessCompletion.js +391 -409
  73. package/lib/umd/services/lint.js +531 -544
  74. package/lib/umd/services/lintRules.js +91 -95
  75. package/lib/umd/services/lintUtil.js +210 -218
  76. package/lib/umd/services/pathCompletion.js +171 -244
  77. package/lib/umd/services/scssCompletion.js +367 -390
  78. package/lib/umd/services/scssNavigation.js +95 -166
  79. package/lib/umd/services/selectorPrinting.js +510 -550
  80. package/lib/umd/utils/arrays.js +55 -61
  81. package/lib/umd/utils/objects.js +25 -25
  82. package/lib/umd/utils/resources.js +26 -39
  83. package/lib/umd/utils/strings.js +120 -122
  84. package/package.json +10 -10
@@ -1,60 +1,60 @@
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", "../cssLanguageTypes", "../parser/cssNodes"], 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.getSelectionRanges = void 0;
17
- var cssLanguageTypes_1 = require("../cssLanguageTypes");
18
- var cssNodes_1 = require("../parser/cssNodes");
19
- function getSelectionRanges(document, positions, stylesheet) {
20
- function getSelectionRange(position) {
21
- var applicableRanges = getApplicableRanges(position);
22
- var current = undefined;
23
- for (var index = applicableRanges.length - 1; index >= 0; index--) {
24
- current = cssLanguageTypes_1.SelectionRange.create(cssLanguageTypes_1.Range.create(document.positionAt(applicableRanges[index][0]), document.positionAt(applicableRanges[index][1])), current);
25
- }
26
- if (!current) {
27
- current = cssLanguageTypes_1.SelectionRange.create(cssLanguageTypes_1.Range.create(position, position));
28
- }
29
- return current;
30
- }
31
- return positions.map(getSelectionRange);
32
- function getApplicableRanges(position) {
33
- var offset = document.offsetAt(position);
34
- var currNode = stylesheet.findChildAtOffset(offset, true);
35
- if (!currNode) {
36
- return [];
37
- }
38
- var result = [];
39
- while (currNode) {
40
- if (currNode.parent &&
41
- currNode.offset === currNode.parent.offset &&
42
- currNode.end === currNode.parent.end) {
43
- currNode = currNode.parent;
44
- continue;
45
- }
46
- // The `{ }` part of `.a { }`
47
- if (currNode.type === cssNodes_1.NodeType.Declarations) {
48
- if (offset > currNode.offset && offset < currNode.end) {
49
- // Return `{ }` and the range inside `{` and `}`
50
- result.push([currNode.offset + 1, currNode.end - 1]);
51
- }
52
- }
53
- result.push([currNode.offset, currNode.end]);
54
- currNode = currNode.parent;
55
- }
56
- return result;
57
- }
58
- }
59
- exports.getSelectionRanges = getSelectionRanges;
60
- });
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", "../cssLanguageTypes", "../parser/cssNodes"], 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.getSelectionRanges = void 0;
17
+ const cssLanguageTypes_1 = require("../cssLanguageTypes");
18
+ const cssNodes_1 = require("../parser/cssNodes");
19
+ function getSelectionRanges(document, positions, stylesheet) {
20
+ function getSelectionRange(position) {
21
+ const applicableRanges = getApplicableRanges(position);
22
+ let current = undefined;
23
+ for (let index = applicableRanges.length - 1; index >= 0; index--) {
24
+ current = cssLanguageTypes_1.SelectionRange.create(cssLanguageTypes_1.Range.create(document.positionAt(applicableRanges[index][0]), document.positionAt(applicableRanges[index][1])), current);
25
+ }
26
+ if (!current) {
27
+ current = cssLanguageTypes_1.SelectionRange.create(cssLanguageTypes_1.Range.create(position, position));
28
+ }
29
+ return current;
30
+ }
31
+ return positions.map(getSelectionRange);
32
+ function getApplicableRanges(position) {
33
+ const offset = document.offsetAt(position);
34
+ let currNode = stylesheet.findChildAtOffset(offset, true);
35
+ if (!currNode) {
36
+ return [];
37
+ }
38
+ const result = [];
39
+ while (currNode) {
40
+ if (currNode.parent &&
41
+ currNode.offset === currNode.parent.offset &&
42
+ currNode.end === currNode.parent.end) {
43
+ currNode = currNode.parent;
44
+ continue;
45
+ }
46
+ // The `{ }` part of `.a { }`
47
+ if (currNode.type === cssNodes_1.NodeType.Declarations) {
48
+ if (offset > currNode.offset && offset < currNode.end) {
49
+ // Return `{ }` and the range inside `{` and `}`
50
+ result.push([currNode.offset + 1, currNode.end - 1]);
51
+ }
52
+ }
53
+ result.push([currNode.offset, currNode.end]);
54
+ currNode = currNode.parent;
55
+ }
56
+ return result;
57
+ }
58
+ }
59
+ exports.getSelectionRanges = getSelectionRanges;
60
+ });
@@ -1,56 +1,54 @@
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", "../parser/cssNodes", "./lintRules", "./lint", "../cssLanguageTypes"], 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.CSSValidation = void 0;
17
- var nodes = require("../parser/cssNodes");
18
- var lintRules_1 = require("./lintRules");
19
- var lint_1 = require("./lint");
20
- var cssLanguageTypes_1 = require("../cssLanguageTypes");
21
- var CSSValidation = /** @class */ (function () {
22
- function CSSValidation(cssDataManager) {
23
- this.cssDataManager = cssDataManager;
24
- }
25
- CSSValidation.prototype.configure = function (settings) {
26
- this.settings = settings;
27
- };
28
- CSSValidation.prototype.doValidation = function (document, stylesheet, settings) {
29
- if (settings === void 0) { settings = this.settings; }
30
- if (settings && settings.validate === false) {
31
- return [];
32
- }
33
- var entries = [];
34
- entries.push.apply(entries, nodes.ParseErrorCollector.entries(stylesheet));
35
- entries.push.apply(entries, lint_1.LintVisitor.entries(stylesheet, document, new lintRules_1.LintConfigurationSettings(settings && settings.lint), this.cssDataManager));
36
- var ruleIds = [];
37
- for (var r in lintRules_1.Rules) {
38
- ruleIds.push(lintRules_1.Rules[r].id);
39
- }
40
- function toDiagnostic(marker) {
41
- var range = cssLanguageTypes_1.Range.create(document.positionAt(marker.getOffset()), document.positionAt(marker.getOffset() + marker.getLength()));
42
- var source = document.languageId;
43
- return {
44
- code: marker.getRule().id,
45
- source: source,
46
- message: marker.getMessage(),
47
- severity: marker.getLevel() === nodes.Level.Warning ? cssLanguageTypes_1.DiagnosticSeverity.Warning : cssLanguageTypes_1.DiagnosticSeverity.Error,
48
- range: range
49
- };
50
- }
51
- return entries.filter(function (entry) { return entry.getLevel() !== nodes.Level.Ignore; }).map(toDiagnostic);
52
- };
53
- return CSSValidation;
54
- }());
55
- exports.CSSValidation = CSSValidation;
56
- });
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", "../parser/cssNodes", "./lintRules", "./lint", "../cssLanguageTypes"], 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.CSSValidation = void 0;
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
+ this.cssDataManager = cssDataManager;
24
+ }
25
+ configure(settings) {
26
+ this.settings = settings;
27
+ }
28
+ doValidation(document, stylesheet, settings = this.settings) {
29
+ if (settings && settings.validate === false) {
30
+ return [];
31
+ }
32
+ const entries = [];
33
+ entries.push.apply(entries, nodes.ParseErrorCollector.entries(stylesheet));
34
+ entries.push.apply(entries, lint_1.LintVisitor.entries(stylesheet, document, new lintRules_1.LintConfigurationSettings(settings && settings.lint), this.cssDataManager));
35
+ const ruleIds = [];
36
+ for (const r in lintRules_1.Rules) {
37
+ ruleIds.push(lintRules_1.Rules[r].id);
38
+ }
39
+ function toDiagnostic(marker) {
40
+ const range = cssLanguageTypes_1.Range.create(document.positionAt(marker.getOffset()), document.positionAt(marker.getOffset() + marker.getLength()));
41
+ const source = document.languageId;
42
+ return {
43
+ code: marker.getRule().id,
44
+ source: source,
45
+ message: marker.getMessage(),
46
+ severity: marker.getLevel() === nodes.Level.Warning ? cssLanguageTypes_1.DiagnosticSeverity.Warning : cssLanguageTypes_1.DiagnosticSeverity.Error,
47
+ range: range
48
+ };
49
+ }
50
+ return entries.filter(entry => entry.getLevel() !== nodes.Level.Ignore).map(toDiagnostic);
51
+ }
52
+ }
53
+ exports.CSSValidation = CSSValidation;
54
+ });