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