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