vscode-css-languageservice 5.3.0 → 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 (87) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +1 -0
  3. package/lib/esm/beautify/beautify-css.js +57 -15
  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 -228
  7. package/lib/esm/cssLanguageTypes.js +42 -42
  8. package/lib/esm/data/webCustomData.js +21965 -21959
  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 -117
  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 +57 -15
  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 -228
  49. package/lib/umd/cssLanguageTypes.js +89 -88
  50. package/lib/umd/data/webCustomData.js +21978 -21972
  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 -131
  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,397 +1,378 @@
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
- var __extends = (this && this.__extends) || (function () {
7
- var extendStatics = function (d, b) {
8
- extendStatics = Object.setPrototypeOf ||
9
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
11
- return extendStatics(d, b);
12
- };
13
- return function (d, b) {
14
- if (typeof b !== "function" && b !== null)
15
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
16
- extendStatics(d, b);
17
- function __() { this.constructor = d; }
18
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19
- };
20
- })();
21
- import { CSSCompletion } from './cssCompletion';
22
- import { CompletionItemKind, InsertTextFormat, TextEdit } from '../cssLanguageTypes';
23
- import * as nls from 'vscode-nls';
24
- var localize = nls.loadMessageBundle();
25
- var LESSCompletion = /** @class */ (function (_super) {
26
- __extends(LESSCompletion, _super);
27
- function LESSCompletion(lsOptions, cssDataManager) {
28
- return _super.call(this, '@', lsOptions, cssDataManager) || this;
29
- }
30
- LESSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, sortToEnd, result) {
31
- for (var _i = 0, proposals_1 = proposals; _i < proposals_1.length; _i++) {
32
- var p = proposals_1[_i];
33
- var item = {
34
- label: p.name,
35
- detail: p.example,
36
- documentation: p.description,
37
- textEdit: TextEdit.replace(this.getCompletionRange(existingNode), p.name + '($0)'),
38
- insertTextFormat: InsertTextFormat.Snippet,
39
- kind: CompletionItemKind.Function
40
- };
41
- if (sortToEnd) {
42
- item.sortText = 'z';
43
- }
44
- result.items.push(item);
45
- }
46
- return result;
47
- };
48
- LESSCompletion.prototype.getTermProposals = function (entry, existingNode, result) {
49
- var functions = LESSCompletion.builtInProposals;
50
- if (entry) {
51
- functions = functions.filter(function (f) { return !f.type || !entry.restrictions || entry.restrictions.indexOf(f.type) !== -1; });
52
- }
53
- this.createFunctionProposals(functions, existingNode, true, result);
54
- return _super.prototype.getTermProposals.call(this, entry, existingNode, result);
55
- };
56
- LESSCompletion.prototype.getColorProposals = function (entry, existingNode, result) {
57
- this.createFunctionProposals(LESSCompletion.colorProposals, existingNode, false, result);
58
- return _super.prototype.getColorProposals.call(this, entry, existingNode, result);
59
- };
60
- LESSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) {
61
- this.getCompletionsForSelector(null, true, result);
62
- return _super.prototype.getCompletionsForDeclarationProperty.call(this, declaration, result);
63
- };
64
- LESSCompletion.builtInProposals = [
65
- // Boolean functions
66
- {
67
- 'name': 'if',
68
- 'example': 'if(condition, trueValue [, falseValue]);',
69
- 'description': localize('less.builtin.if', 'returns one of two values depending on a condition.')
70
- },
71
- {
72
- 'name': 'boolean',
73
- 'example': 'boolean(condition);',
74
- 'description': localize('less.builtin.boolean', '"store" a boolean test for later evaluation in a guard or if().')
75
- },
76
- // List functions
77
- {
78
- 'name': 'length',
79
- 'example': 'length(@list);',
80
- 'description': localize('less.builtin.length', 'returns the number of elements in a value list')
81
- },
82
- {
83
- 'name': 'extract',
84
- 'example': 'extract(@list, index);',
85
- 'description': localize('less.builtin.extract', 'returns a value at the specified position in the list')
86
- },
87
- {
88
- 'name': 'range',
89
- 'example': 'range([start, ] end [, step]);',
90
- 'description': localize('less.builtin.range', 'generate a list spanning a range of values')
91
- },
92
- {
93
- 'name': 'each',
94
- 'example': 'each(@list, ruleset);',
95
- 'description': localize('less.builtin.each', 'bind the evaluation of a ruleset to each member of a list.')
96
- },
97
- // Other built-ins
98
- {
99
- 'name': 'escape',
100
- 'example': 'escape(@string);',
101
- 'description': localize('less.builtin.escape', 'URL encodes a string')
102
- },
103
- {
104
- 'name': 'e',
105
- 'example': 'e(@string);',
106
- 'description': localize('less.builtin.e', 'escape string content')
107
- },
108
- {
109
- 'name': 'replace',
110
- 'example': 'replace(@string, @pattern, @replacement[, @flags]);',
111
- 'description': localize('less.builtin.replace', 'string replace')
112
- },
113
- {
114
- 'name': 'unit',
115
- 'example': 'unit(@dimension, [@unit: \'\']);',
116
- 'description': localize('less.builtin.unit', 'remove or change the unit of a dimension')
117
- },
118
- {
119
- 'name': 'color',
120
- 'example': 'color(@string);',
121
- 'description': localize('less.builtin.color', 'parses a string to a color'),
122
- 'type': 'color'
123
- },
124
- {
125
- 'name': 'convert',
126
- 'example': 'convert(@value, unit);',
127
- 'description': localize('less.builtin.convert', 'converts numbers from one type into another')
128
- },
129
- {
130
- 'name': 'data-uri',
131
- 'example': 'data-uri([mimetype,] url);',
132
- 'description': localize('less.builtin.data-uri', 'inlines a resource and falls back to `url()`'),
133
- 'type': 'url'
134
- },
135
- {
136
- 'name': 'abs',
137
- 'description': localize('less.builtin.abs', 'absolute value of a number'),
138
- 'example': 'abs(number);'
139
- },
140
- {
141
- 'name': 'acos',
142
- 'description': localize('less.builtin.acos', 'arccosine - inverse of cosine function'),
143
- 'example': 'acos(number);'
144
- },
145
- {
146
- 'name': 'asin',
147
- 'description': localize('less.builtin.asin', 'arcsine - inverse of sine function'),
148
- 'example': 'asin(number);'
149
- },
150
- {
151
- 'name': 'ceil',
152
- 'example': 'ceil(@number);',
153
- 'description': localize('less.builtin.ceil', 'rounds up to an integer')
154
- },
155
- {
156
- 'name': 'cos',
157
- 'description': localize('less.builtin.cos', 'cosine function'),
158
- 'example': 'cos(number);'
159
- },
160
- {
161
- 'name': 'floor',
162
- 'description': localize('less.builtin.floor', 'rounds down to an integer'),
163
- 'example': 'floor(@number);'
164
- },
165
- {
166
- 'name': 'percentage',
167
- 'description': localize('less.builtin.percentage', 'converts to a %, e.g. 0.5 > 50%'),
168
- 'example': 'percentage(@number);',
169
- 'type': 'percentage'
170
- },
171
- {
172
- 'name': 'round',
173
- 'description': localize('less.builtin.round', 'rounds a number to a number of places'),
174
- 'example': 'round(number, [places: 0]);'
175
- },
176
- {
177
- 'name': 'sqrt',
178
- 'description': localize('less.builtin.sqrt', 'calculates square root of a number'),
179
- 'example': 'sqrt(number);'
180
- },
181
- {
182
- 'name': 'sin',
183
- 'description': localize('less.builtin.sin', 'sine function'),
184
- 'example': 'sin(number);'
185
- },
186
- {
187
- 'name': 'tan',
188
- 'description': localize('less.builtin.tan', 'tangent function'),
189
- 'example': 'tan(number);'
190
- },
191
- {
192
- 'name': 'atan',
193
- 'description': localize('less.builtin.atan', 'arctangent - inverse of tangent function'),
194
- 'example': 'atan(number);'
195
- },
196
- {
197
- 'name': 'pi',
198
- 'description': localize('less.builtin.pi', 'returns pi'),
199
- 'example': 'pi();'
200
- },
201
- {
202
- 'name': 'pow',
203
- 'description': localize('less.builtin.pow', 'first argument raised to the power of the second argument'),
204
- 'example': 'pow(@base, @exponent);'
205
- },
206
- {
207
- 'name': 'mod',
208
- 'description': localize('less.builtin.mod', 'first argument modulus second argument'),
209
- 'example': 'mod(number, number);'
210
- },
211
- {
212
- 'name': 'min',
213
- 'description': localize('less.builtin.min', 'returns the lowest of one or more values'),
214
- 'example': 'min(@x, @y);'
215
- },
216
- {
217
- 'name': 'max',
218
- 'description': localize('less.builtin.max', 'returns the lowest of one or more values'),
219
- 'example': 'max(@x, @y);'
220
- }
221
- ];
222
- LESSCompletion.colorProposals = [
223
- {
224
- 'name': 'argb',
225
- 'example': 'argb(@color);',
226
- 'description': localize('less.builtin.argb', 'creates a #AARRGGBB')
227
- },
228
- {
229
- 'name': 'hsl',
230
- 'example': 'hsl(@hue, @saturation, @lightness);',
231
- 'description': localize('less.builtin.hsl', 'creates a color')
232
- },
233
- {
234
- 'name': 'hsla',
235
- 'example': 'hsla(@hue, @saturation, @lightness, @alpha);',
236
- 'description': localize('less.builtin.hsla', 'creates a color')
237
- },
238
- {
239
- 'name': 'hsv',
240
- 'example': 'hsv(@hue, @saturation, @value);',
241
- 'description': localize('less.builtin.hsv', 'creates a color')
242
- },
243
- {
244
- 'name': 'hsva',
245
- 'example': 'hsva(@hue, @saturation, @value, @alpha);',
246
- 'description': localize('less.builtin.hsva', 'creates a color')
247
- },
248
- {
249
- 'name': 'hue',
250
- 'example': 'hue(@color);',
251
- 'description': localize('less.builtin.hue', 'returns the `hue` channel of `@color` in the HSL space')
252
- },
253
- {
254
- 'name': 'saturation',
255
- 'example': 'saturation(@color);',
256
- 'description': localize('less.builtin.saturation', 'returns the `saturation` channel of `@color` in the HSL space')
257
- },
258
- {
259
- 'name': 'lightness',
260
- 'example': 'lightness(@color);',
261
- 'description': localize('less.builtin.lightness', 'returns the `lightness` channel of `@color` in the HSL space')
262
- },
263
- {
264
- 'name': 'hsvhue',
265
- 'example': 'hsvhue(@color);',
266
- 'description': localize('less.builtin.hsvhue', 'returns the `hue` channel of `@color` in the HSV space')
267
- },
268
- {
269
- 'name': 'hsvsaturation',
270
- 'example': 'hsvsaturation(@color);',
271
- 'description': localize('less.builtin.hsvsaturation', 'returns the `saturation` channel of `@color` in the HSV space')
272
- },
273
- {
274
- 'name': 'hsvvalue',
275
- 'example': 'hsvvalue(@color);',
276
- 'description': localize('less.builtin.hsvvalue', 'returns the `value` channel of `@color` in the HSV space')
277
- },
278
- {
279
- 'name': 'red',
280
- 'example': 'red(@color);',
281
- 'description': localize('less.builtin.red', 'returns the `red` channel of `@color`')
282
- },
283
- {
284
- 'name': 'green',
285
- 'example': 'green(@color);',
286
- 'description': localize('less.builtin.green', 'returns the `green` channel of `@color`')
287
- },
288
- {
289
- 'name': 'blue',
290
- 'example': 'blue(@color);',
291
- 'description': localize('less.builtin.blue', 'returns the `blue` channel of `@color`')
292
- },
293
- {
294
- 'name': 'alpha',
295
- 'example': 'alpha(@color);',
296
- 'description': localize('less.builtin.alpha', 'returns the `alpha` channel of `@color`')
297
- },
298
- {
299
- 'name': 'luma',
300
- 'example': 'luma(@color);',
301
- 'description': localize('less.builtin.luma', 'returns the `luma` value (perceptual brightness) of `@color`')
302
- },
303
- {
304
- 'name': 'saturate',
305
- 'example': 'saturate(@color, 10%);',
306
- 'description': localize('less.builtin.saturate', 'return `@color` 10% points more saturated')
307
- },
308
- {
309
- 'name': 'desaturate',
310
- 'example': 'desaturate(@color, 10%);',
311
- 'description': localize('less.builtin.desaturate', 'return `@color` 10% points less saturated')
312
- },
313
- {
314
- 'name': 'lighten',
315
- 'example': 'lighten(@color, 10%);',
316
- 'description': localize('less.builtin.lighten', 'return `@color` 10% points lighter')
317
- },
318
- {
319
- 'name': 'darken',
320
- 'example': 'darken(@color, 10%);',
321
- 'description': localize('less.builtin.darken', 'return `@color` 10% points darker')
322
- },
323
- {
324
- 'name': 'fadein',
325
- 'example': 'fadein(@color, 10%);',
326
- 'description': localize('less.builtin.fadein', 'return `@color` 10% points less transparent')
327
- },
328
- {
329
- 'name': 'fadeout',
330
- 'example': 'fadeout(@color, 10%);',
331
- 'description': localize('less.builtin.fadeout', 'return `@color` 10% points more transparent')
332
- },
333
- {
334
- 'name': 'fade',
335
- 'example': 'fade(@color, 50%);',
336
- 'description': localize('less.builtin.fade', 'return `@color` with 50% transparency')
337
- },
338
- {
339
- 'name': 'spin',
340
- 'example': 'spin(@color, 10);',
341
- 'description': localize('less.builtin.spin', 'return `@color` with a 10 degree larger in hue')
342
- },
343
- {
344
- 'name': 'mix',
345
- 'example': 'mix(@color1, @color2, [@weight: 50%]);',
346
- 'description': localize('less.builtin.mix', 'return a mix of `@color1` and `@color2`')
347
- },
348
- {
349
- 'name': 'greyscale',
350
- 'example': 'greyscale(@color);',
351
- 'description': localize('less.builtin.greyscale', 'returns a grey, 100% desaturated color'),
352
- },
353
- {
354
- 'name': 'contrast',
355
- 'example': 'contrast(@color1, [@darkcolor: black], [@lightcolor: white], [@threshold: 43%]);',
356
- 'description': localize('less.builtin.contrast', 'return `@darkcolor` if `@color1 is> 43% luma` otherwise return `@lightcolor`, see notes')
357
- },
358
- {
359
- 'name': 'multiply',
360
- 'example': 'multiply(@color1, @color2);'
361
- },
362
- {
363
- 'name': 'screen',
364
- 'example': 'screen(@color1, @color2);'
365
- },
366
- {
367
- 'name': 'overlay',
368
- 'example': 'overlay(@color1, @color2);'
369
- },
370
- {
371
- 'name': 'softlight',
372
- 'example': 'softlight(@color1, @color2);'
373
- },
374
- {
375
- 'name': 'hardlight',
376
- 'example': 'hardlight(@color1, @color2);'
377
- },
378
- {
379
- 'name': 'difference',
380
- 'example': 'difference(@color1, @color2);'
381
- },
382
- {
383
- 'name': 'exclusion',
384
- 'example': 'exclusion(@color1, @color2);'
385
- },
386
- {
387
- 'name': 'average',
388
- 'example': 'average(@color1, @color2);'
389
- },
390
- {
391
- 'name': 'negation',
392
- 'example': 'negation(@color1, @color2);'
393
- }
394
- ];
395
- return LESSCompletion;
396
- }(CSSCompletion));
397
- export { LESSCompletion };
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 { CSSCompletion } from './cssCompletion';
7
+ import { CompletionItemKind, InsertTextFormat, TextEdit } from '../cssLanguageTypes';
8
+ import * as nls from 'vscode-nls';
9
+ const localize = nls.loadMessageBundle();
10
+ export class LESSCompletion extends CSSCompletion {
11
+ constructor(lsOptions, cssDataManager) {
12
+ super('@', lsOptions, cssDataManager);
13
+ }
14
+ createFunctionProposals(proposals, existingNode, sortToEnd, result) {
15
+ for (const p of proposals) {
16
+ const item = {
17
+ label: p.name,
18
+ detail: p.example,
19
+ documentation: p.description,
20
+ textEdit: TextEdit.replace(this.getCompletionRange(existingNode), p.name + '($0)'),
21
+ insertTextFormat: InsertTextFormat.Snippet,
22
+ kind: CompletionItemKind.Function
23
+ };
24
+ if (sortToEnd) {
25
+ item.sortText = 'z';
26
+ }
27
+ result.items.push(item);
28
+ }
29
+ return result;
30
+ }
31
+ getTermProposals(entry, existingNode, result) {
32
+ let functions = LESSCompletion.builtInProposals;
33
+ if (entry) {
34
+ functions = functions.filter(f => !f.type || !entry.restrictions || entry.restrictions.indexOf(f.type) !== -1);
35
+ }
36
+ this.createFunctionProposals(functions, existingNode, true, result);
37
+ return super.getTermProposals(entry, existingNode, result);
38
+ }
39
+ getColorProposals(entry, existingNode, result) {
40
+ this.createFunctionProposals(LESSCompletion.colorProposals, existingNode, false, result);
41
+ return super.getColorProposals(entry, existingNode, result);
42
+ }
43
+ getCompletionsForDeclarationProperty(declaration, result) {
44
+ this.getCompletionsForSelector(null, true, result);
45
+ return super.getCompletionsForDeclarationProperty(declaration, result);
46
+ }
47
+ }
48
+ LESSCompletion.builtInProposals = [
49
+ // Boolean functions
50
+ {
51
+ 'name': 'if',
52
+ 'example': 'if(condition, trueValue [, falseValue]);',
53
+ 'description': localize('less.builtin.if', 'returns one of two values depending on a condition.')
54
+ },
55
+ {
56
+ 'name': 'boolean',
57
+ 'example': 'boolean(condition);',
58
+ 'description': localize('less.builtin.boolean', '"store" a boolean test for later evaluation in a guard or if().')
59
+ },
60
+ // List functions
61
+ {
62
+ 'name': 'length',
63
+ 'example': 'length(@list);',
64
+ 'description': localize('less.builtin.length', 'returns the number of elements in a value list')
65
+ },
66
+ {
67
+ 'name': 'extract',
68
+ 'example': 'extract(@list, index);',
69
+ 'description': localize('less.builtin.extract', 'returns a value at the specified position in the list')
70
+ },
71
+ {
72
+ 'name': 'range',
73
+ 'example': 'range([start, ] end [, step]);',
74
+ 'description': localize('less.builtin.range', 'generate a list spanning a range of values')
75
+ },
76
+ {
77
+ 'name': 'each',
78
+ 'example': 'each(@list, ruleset);',
79
+ 'description': localize('less.builtin.each', 'bind the evaluation of a ruleset to each member of a list.')
80
+ },
81
+ // Other built-ins
82
+ {
83
+ 'name': 'escape',
84
+ 'example': 'escape(@string);',
85
+ 'description': localize('less.builtin.escape', 'URL encodes a string')
86
+ },
87
+ {
88
+ 'name': 'e',
89
+ 'example': 'e(@string);',
90
+ 'description': localize('less.builtin.e', 'escape string content')
91
+ },
92
+ {
93
+ 'name': 'replace',
94
+ 'example': 'replace(@string, @pattern, @replacement[, @flags]);',
95
+ 'description': localize('less.builtin.replace', 'string replace')
96
+ },
97
+ {
98
+ 'name': 'unit',
99
+ 'example': 'unit(@dimension, [@unit: \'\']);',
100
+ 'description': localize('less.builtin.unit', 'remove or change the unit of a dimension')
101
+ },
102
+ {
103
+ 'name': 'color',
104
+ 'example': 'color(@string);',
105
+ 'description': localize('less.builtin.color', 'parses a string to a color'),
106
+ 'type': 'color'
107
+ },
108
+ {
109
+ 'name': 'convert',
110
+ 'example': 'convert(@value, unit);',
111
+ 'description': localize('less.builtin.convert', 'converts numbers from one type into another')
112
+ },
113
+ {
114
+ 'name': 'data-uri',
115
+ 'example': 'data-uri([mimetype,] url);',
116
+ 'description': localize('less.builtin.data-uri', 'inlines a resource and falls back to `url()`'),
117
+ 'type': 'url'
118
+ },
119
+ {
120
+ 'name': 'abs',
121
+ 'description': localize('less.builtin.abs', 'absolute value of a number'),
122
+ 'example': 'abs(number);'
123
+ },
124
+ {
125
+ 'name': 'acos',
126
+ 'description': localize('less.builtin.acos', 'arccosine - inverse of cosine function'),
127
+ 'example': 'acos(number);'
128
+ },
129
+ {
130
+ 'name': 'asin',
131
+ 'description': localize('less.builtin.asin', 'arcsine - inverse of sine function'),
132
+ 'example': 'asin(number);'
133
+ },
134
+ {
135
+ 'name': 'ceil',
136
+ 'example': 'ceil(@number);',
137
+ 'description': localize('less.builtin.ceil', 'rounds up to an integer')
138
+ },
139
+ {
140
+ 'name': 'cos',
141
+ 'description': localize('less.builtin.cos', 'cosine function'),
142
+ 'example': 'cos(number);'
143
+ },
144
+ {
145
+ 'name': 'floor',
146
+ 'description': localize('less.builtin.floor', 'rounds down to an integer'),
147
+ 'example': 'floor(@number);'
148
+ },
149
+ {
150
+ 'name': 'percentage',
151
+ 'description': localize('less.builtin.percentage', 'converts to a %, e.g. 0.5 > 50%'),
152
+ 'example': 'percentage(@number);',
153
+ 'type': 'percentage'
154
+ },
155
+ {
156
+ 'name': 'round',
157
+ 'description': localize('less.builtin.round', 'rounds a number to a number of places'),
158
+ 'example': 'round(number, [places: 0]);'
159
+ },
160
+ {
161
+ 'name': 'sqrt',
162
+ 'description': localize('less.builtin.sqrt', 'calculates square root of a number'),
163
+ 'example': 'sqrt(number);'
164
+ },
165
+ {
166
+ 'name': 'sin',
167
+ 'description': localize('less.builtin.sin', 'sine function'),
168
+ 'example': 'sin(number);'
169
+ },
170
+ {
171
+ 'name': 'tan',
172
+ 'description': localize('less.builtin.tan', 'tangent function'),
173
+ 'example': 'tan(number);'
174
+ },
175
+ {
176
+ 'name': 'atan',
177
+ 'description': localize('less.builtin.atan', 'arctangent - inverse of tangent function'),
178
+ 'example': 'atan(number);'
179
+ },
180
+ {
181
+ 'name': 'pi',
182
+ 'description': localize('less.builtin.pi', 'returns pi'),
183
+ 'example': 'pi();'
184
+ },
185
+ {
186
+ 'name': 'pow',
187
+ 'description': localize('less.builtin.pow', 'first argument raised to the power of the second argument'),
188
+ 'example': 'pow(@base, @exponent);'
189
+ },
190
+ {
191
+ 'name': 'mod',
192
+ 'description': localize('less.builtin.mod', 'first argument modulus second argument'),
193
+ 'example': 'mod(number, number);'
194
+ },
195
+ {
196
+ 'name': 'min',
197
+ 'description': localize('less.builtin.min', 'returns the lowest of one or more values'),
198
+ 'example': 'min(@x, @y);'
199
+ },
200
+ {
201
+ 'name': 'max',
202
+ 'description': localize('less.builtin.max', 'returns the lowest of one or more values'),
203
+ 'example': 'max(@x, @y);'
204
+ }
205
+ ];
206
+ LESSCompletion.colorProposals = [
207
+ {
208
+ 'name': 'argb',
209
+ 'example': 'argb(@color);',
210
+ 'description': localize('less.builtin.argb', 'creates a #AARRGGBB')
211
+ },
212
+ {
213
+ 'name': 'hsl',
214
+ 'example': 'hsl(@hue, @saturation, @lightness);',
215
+ 'description': localize('less.builtin.hsl', 'creates a color')
216
+ },
217
+ {
218
+ 'name': 'hsla',
219
+ 'example': 'hsla(@hue, @saturation, @lightness, @alpha);',
220
+ 'description': localize('less.builtin.hsla', 'creates a color')
221
+ },
222
+ {
223
+ 'name': 'hsv',
224
+ 'example': 'hsv(@hue, @saturation, @value);',
225
+ 'description': localize('less.builtin.hsv', 'creates a color')
226
+ },
227
+ {
228
+ 'name': 'hsva',
229
+ 'example': 'hsva(@hue, @saturation, @value, @alpha);',
230
+ 'description': localize('less.builtin.hsva', 'creates a color')
231
+ },
232
+ {
233
+ 'name': 'hue',
234
+ 'example': 'hue(@color);',
235
+ 'description': localize('less.builtin.hue', 'returns the `hue` channel of `@color` in the HSL space')
236
+ },
237
+ {
238
+ 'name': 'saturation',
239
+ 'example': 'saturation(@color);',
240
+ 'description': localize('less.builtin.saturation', 'returns the `saturation` channel of `@color` in the HSL space')
241
+ },
242
+ {
243
+ 'name': 'lightness',
244
+ 'example': 'lightness(@color);',
245
+ 'description': localize('less.builtin.lightness', 'returns the `lightness` channel of `@color` in the HSL space')
246
+ },
247
+ {
248
+ 'name': 'hsvhue',
249
+ 'example': 'hsvhue(@color);',
250
+ 'description': localize('less.builtin.hsvhue', 'returns the `hue` channel of `@color` in the HSV space')
251
+ },
252
+ {
253
+ 'name': 'hsvsaturation',
254
+ 'example': 'hsvsaturation(@color);',
255
+ 'description': localize('less.builtin.hsvsaturation', 'returns the `saturation` channel of `@color` in the HSV space')
256
+ },
257
+ {
258
+ 'name': 'hsvvalue',
259
+ 'example': 'hsvvalue(@color);',
260
+ 'description': localize('less.builtin.hsvvalue', 'returns the `value` channel of `@color` in the HSV space')
261
+ },
262
+ {
263
+ 'name': 'red',
264
+ 'example': 'red(@color);',
265
+ 'description': localize('less.builtin.red', 'returns the `red` channel of `@color`')
266
+ },
267
+ {
268
+ 'name': 'green',
269
+ 'example': 'green(@color);',
270
+ 'description': localize('less.builtin.green', 'returns the `green` channel of `@color`')
271
+ },
272
+ {
273
+ 'name': 'blue',
274
+ 'example': 'blue(@color);',
275
+ 'description': localize('less.builtin.blue', 'returns the `blue` channel of `@color`')
276
+ },
277
+ {
278
+ 'name': 'alpha',
279
+ 'example': 'alpha(@color);',
280
+ 'description': localize('less.builtin.alpha', 'returns the `alpha` channel of `@color`')
281
+ },
282
+ {
283
+ 'name': 'luma',
284
+ 'example': 'luma(@color);',
285
+ 'description': localize('less.builtin.luma', 'returns the `luma` value (perceptual brightness) of `@color`')
286
+ },
287
+ {
288
+ 'name': 'saturate',
289
+ 'example': 'saturate(@color, 10%);',
290
+ 'description': localize('less.builtin.saturate', 'return `@color` 10% points more saturated')
291
+ },
292
+ {
293
+ 'name': 'desaturate',
294
+ 'example': 'desaturate(@color, 10%);',
295
+ 'description': localize('less.builtin.desaturate', 'return `@color` 10% points less saturated')
296
+ },
297
+ {
298
+ 'name': 'lighten',
299
+ 'example': 'lighten(@color, 10%);',
300
+ 'description': localize('less.builtin.lighten', 'return `@color` 10% points lighter')
301
+ },
302
+ {
303
+ 'name': 'darken',
304
+ 'example': 'darken(@color, 10%);',
305
+ 'description': localize('less.builtin.darken', 'return `@color` 10% points darker')
306
+ },
307
+ {
308
+ 'name': 'fadein',
309
+ 'example': 'fadein(@color, 10%);',
310
+ 'description': localize('less.builtin.fadein', 'return `@color` 10% points less transparent')
311
+ },
312
+ {
313
+ 'name': 'fadeout',
314
+ 'example': 'fadeout(@color, 10%);',
315
+ 'description': localize('less.builtin.fadeout', 'return `@color` 10% points more transparent')
316
+ },
317
+ {
318
+ 'name': 'fade',
319
+ 'example': 'fade(@color, 50%);',
320
+ 'description': localize('less.builtin.fade', 'return `@color` with 50% transparency')
321
+ },
322
+ {
323
+ 'name': 'spin',
324
+ 'example': 'spin(@color, 10);',
325
+ 'description': localize('less.builtin.spin', 'return `@color` with a 10 degree larger in hue')
326
+ },
327
+ {
328
+ 'name': 'mix',
329
+ 'example': 'mix(@color1, @color2, [@weight: 50%]);',
330
+ 'description': localize('less.builtin.mix', 'return a mix of `@color1` and `@color2`')
331
+ },
332
+ {
333
+ 'name': 'greyscale',
334
+ 'example': 'greyscale(@color);',
335
+ 'description': localize('less.builtin.greyscale', 'returns a grey, 100% desaturated color'),
336
+ },
337
+ {
338
+ 'name': 'contrast',
339
+ 'example': 'contrast(@color1, [@darkcolor: black], [@lightcolor: white], [@threshold: 43%]);',
340
+ 'description': localize('less.builtin.contrast', 'return `@darkcolor` if `@color1 is> 43% luma` otherwise return `@lightcolor`, see notes')
341
+ },
342
+ {
343
+ 'name': 'multiply',
344
+ 'example': 'multiply(@color1, @color2);'
345
+ },
346
+ {
347
+ 'name': 'screen',
348
+ 'example': 'screen(@color1, @color2);'
349
+ },
350
+ {
351
+ 'name': 'overlay',
352
+ 'example': 'overlay(@color1, @color2);'
353
+ },
354
+ {
355
+ 'name': 'softlight',
356
+ 'example': 'softlight(@color1, @color2);'
357
+ },
358
+ {
359
+ 'name': 'hardlight',
360
+ 'example': 'hardlight(@color1, @color2);'
361
+ },
362
+ {
363
+ 'name': 'difference',
364
+ 'example': 'difference(@color1, @color2);'
365
+ },
366
+ {
367
+ 'name': 'exclusion',
368
+ 'example': 'exclusion(@color1, @color2);'
369
+ },
370
+ {
371
+ 'name': 'average',
372
+ 'example': 'average(@color1, @color2);'
373
+ },
374
+ {
375
+ 'name': 'negation',
376
+ 'example': 'negation(@color1, @color2);'
377
+ }
378
+ ];