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.
Files changed (83) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/SECURITY.md +41 -0
  3. package/lib/esm/beautify/beautify-css.js +11 -4
  4. package/lib/esm/cssLanguageService.d.ts +2 -1
  5. package/lib/esm/cssLanguageService.js +15 -17
  6. package/lib/esm/cssLanguageTypes.js +2 -2
  7. package/lib/esm/data/webCustomData.js +356 -232
  8. package/lib/esm/languageFacts/builtinData.js +15 -15
  9. package/lib/esm/languageFacts/colors.js +66 -69
  10. package/lib/esm/languageFacts/dataManager.js +38 -42
  11. package/lib/esm/languageFacts/dataProvider.js +17 -23
  12. package/lib/esm/languageFacts/entry.js +22 -23
  13. package/lib/esm/parser/cssErrors.js +5 -7
  14. package/lib/esm/parser/cssNodes.js +869 -1377
  15. package/lib/esm/parser/cssParser.js +419 -376
  16. package/lib/esm/parser/cssScanner.js +168 -175
  17. package/lib/esm/parser/cssSymbolScope.js +107 -137
  18. package/lib/esm/parser/lessParser.js +177 -202
  19. package/lib/esm/parser/lessScanner.js +22 -43
  20. package/lib/esm/parser/scssErrors.js +5 -7
  21. package/lib/esm/parser/scssParser.js +196 -208
  22. package/lib/esm/parser/scssScanner.js +33 -54
  23. package/lib/esm/services/cssCodeActions.js +36 -40
  24. package/lib/esm/services/cssCompletion.js +300 -395
  25. package/lib/esm/services/cssFolding.js +32 -35
  26. package/lib/esm/services/cssFormatter.js +22 -22
  27. package/lib/esm/services/cssHover.js +30 -33
  28. package/lib/esm/services/cssNavigation.js +260 -289
  29. package/lib/esm/services/cssSelectionRange.js +6 -6
  30. package/lib/esm/services/cssValidation.js +13 -16
  31. package/lib/esm/services/lessCompletion.js +351 -370
  32. package/lib/esm/services/lint.js +161 -175
  33. package/lib/esm/services/lintRules.js +20 -27
  34. package/lib/esm/services/lintUtil.js +19 -28
  35. package/lib/esm/services/pathCompletion.js +84 -158
  36. package/lib/esm/services/scssCompletion.js +283 -307
  37. package/lib/esm/services/scssNavigation.js +65 -137
  38. package/lib/esm/services/selectorPrinting.js +131 -175
  39. package/lib/esm/utils/arrays.js +6 -12
  40. package/lib/esm/utils/objects.js +1 -1
  41. package/lib/esm/utils/resources.js +3 -16
  42. package/lib/esm/utils/strings.js +10 -12
  43. package/lib/umd/beautify/beautify-css.js +11 -4
  44. package/lib/umd/cssLanguageService.d.ts +2 -1
  45. package/lib/umd/cssLanguageService.js +34 -32
  46. package/lib/umd/cssLanguageTypes.js +4 -3
  47. package/lib/umd/data/webCustomData.js +355 -231
  48. package/lib/umd/languageFacts/colors.js +65 -68
  49. package/lib/umd/languageFacts/dataManager.js +41 -44
  50. package/lib/umd/languageFacts/dataProvider.js +17 -22
  51. package/lib/umd/languageFacts/entry.js +22 -23
  52. package/lib/umd/languageFacts/facts.js +5 -1
  53. package/lib/umd/parser/cssErrors.js +5 -6
  54. package/lib/umd/parser/cssNodes.js +870 -1307
  55. package/lib/umd/parser/cssParser.js +424 -380
  56. package/lib/umd/parser/cssScanner.js +168 -173
  57. package/lib/umd/parser/cssSymbolScope.js +109 -134
  58. package/lib/umd/parser/lessParser.js +182 -206
  59. package/lib/umd/parser/lessScanner.js +22 -42
  60. package/lib/umd/parser/scssErrors.js +5 -6
  61. package/lib/umd/parser/scssParser.js +202 -213
  62. package/lib/umd/parser/scssScanner.js +25 -45
  63. package/lib/umd/services/cssCodeActions.js +41 -44
  64. package/lib/umd/services/cssCompletion.js +308 -402
  65. package/lib/umd/services/cssFolding.js +35 -38
  66. package/lib/umd/services/cssFormatter.js +25 -25
  67. package/lib/umd/services/cssHover.js +36 -38
  68. package/lib/umd/services/cssNavigation.js +267 -295
  69. package/lib/umd/services/cssSelectionRange.js +8 -8
  70. package/lib/umd/services/cssValidation.js +17 -19
  71. package/lib/umd/services/lessCompletion.js +354 -372
  72. package/lib/umd/services/lint.js +167 -180
  73. package/lib/umd/services/lintRules.js +20 -24
  74. package/lib/umd/services/lintUtil.js +20 -28
  75. package/lib/umd/services/pathCompletion.js +87 -160
  76. package/lib/umd/services/scssCompletion.js +287 -310
  77. package/lib/umd/services/scssNavigation.js +69 -140
  78. package/lib/umd/services/selectorPrinting.js +134 -174
  79. package/lib/umd/utils/arrays.js +6 -12
  80. package/lib/umd/utils/objects.js +1 -1
  81. package/lib/umd/utils/resources.js +4 -17
  82. package/lib/umd/utils/strings.js +10 -12
  83. package/package.json +16 -15
@@ -4,7 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  'use strict';
6
6
  import { MarkupKind } from '../cssLanguageTypes';
7
- export var browserNames = {
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
- var result;
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
- var result = '';
58
- if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) {
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
- var browserLabel = getBrowserLabel(entry.browsers);
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 += "\n\nSyntax: ".concat(entry.syntax);
68
+ result += `\n\nSyntax: ${entry.syntax}`;
69
69
  }
70
70
  }
71
- if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
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(function (r) {
76
- return "".concat(r.name, ": ").concat(r.url);
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
- var result = '';
86
- if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) {
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
- var browserLabel = getBrowserLabel(entry.browsers);
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 += "\n\nSyntax: ".concat(textToMarkedString(entry.syntax));
101
+ result += `\n\nSyntax: ${textToMarkedString(entry.syntax)}`;
102
102
  }
103
103
  }
104
- if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
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(function (r) {
109
- return "[".concat(r.name, "](").concat(r.url, ")");
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(function (b) {
125
- var result = '';
126
- var matches = b.match(/([A-Z]+)(\d+)?/);
127
- var name = matches[1];
128
- var version = matches[2];
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
- var localize = nls.loadMessageBundle();
8
- var CSSIssueType = /** @class */ (function () {
9
- function CSSIssueType(id, message) {
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
- return CSSIssueType;
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")),