1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366 | 1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
16×
1×
12×
12×
372×
12×
1×
6×
6×
1×
6×
6×
1×
1×
1×
1×
| var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
(function (factory) {
Eif (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
Iif (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./cssCompletion", "vscode-languageserver-types", "vscode-nls"], factory);
}
})(function (require, exports) {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
var cssCompletion_1 = require("./cssCompletion");
var vscode_languageserver_types_1 = require("vscode-languageserver-types");
var nls = require("vscode-nls");
var localize = nls.loadMessageBundle();
var LESSCompletion = (function (_super) {
__extends(LESSCompletion, _super);
function LESSCompletion() {
return _super.call(this, '@') || this;
}
LESSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, result) {
var _this = this;
proposals.forEach(function (p) {
result.items.push({
label: p.name,
detail: p.example,
documentation: p.description,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), p.name + '($0)'),
insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.Snippet,
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
});
return result;
};
LESSCompletion.prototype.getTermProposals = function (existingNode, result) {
this.createFunctionProposals(LESSCompletion.builtInProposals, existingNode, result);
return _super.prototype.getTermProposals.call(this, existingNode, result);
};
LESSCompletion.prototype.getColorProposals = function (entry, existingNode, result) {
this.createFunctionProposals(LESSCompletion.colorProposals, existingNode, result);
return _super.prototype.getColorProposals.call(this, entry, existingNode, result);
};
return LESSCompletion;
}(cssCompletion_1.CSSCompletion));
LESSCompletion.builtInProposals = [
{
'name': 'escape',
'example': 'escape(@string);',
'description': localize('less.builtin.escape', 'URL encodes a string')
},
{
'name': 'e',
'example': 'e(@string);',
'description': localize('less.builtin.e', 'escape string content')
},
{
'name': 'replace',
'example': 'replace(@string, @pattern, @replacement[, @flags]);',
'description': localize('less.builtin.replace', 'string replace')
},
{
'name': 'unit',
'example': 'unit(@dimension, [@unit: \'\']);',
'description': localize('less.builtin.unit', 'remove or change the unit of a dimension')
},
{
'name': 'color',
'example': 'color(@string);',
'description': localize('less.builtin.color', 'parses a string to a color')
},
{
'name': 'convert',
'example': 'convert(@value, unit);',
'description': localize('less.builtin.convert', 'converts numbers from one type into another')
},
{
'name': 'data-uri',
'example': 'data-uri([mimetype,] url);',
'description': localize('less.builtin.data-uri', 'inlines a resource and falls back to `url()`')
},
{
'name': 'length',
'example': 'length(@list);',
'description': localize('less.builtin.length', 'returns the number of elements in a value list')
},
{
'name': 'extract',
'example': 'extract(@list, index);',
'description': localize('less.builtin.extract', 'returns a value at the specified position in the list')
},
{
'name': 'abs',
'description': localize('less.builtin.abs', 'absolute value of a number'),
'example': 'abs(number);'
},
{
'name': 'acos',
'description': localize('less.builtin.acos', 'arccosine - inverse of cosine function'),
'example': 'acos(number);'
},
{
'name': 'asin',
'description': localize('less.builtin.asin', 'arcsine - inverse of sine function'),
'example': 'asin(number);'
},
{
'name': 'ceil',
'example': 'ceil(@number);',
'description': localize('less.builtin.ceil', 'rounds up to an integer')
},
{
'name': 'cos',
'description': localize('less.builtin.cos', 'cosine function'),
'example': 'cos(number);'
},
{
'name': 'floor',
'description': localize('less.builtin.floor', 'rounds down to an integer'),
'example': 'floor(@number);'
},
{
'name': 'percentage',
'description': localize('less.builtin.percentage', 'converts to a %, e.g. 0.5 > 50%'),
'example': 'percentage(@number);'
},
{
'name': 'round',
'description': localize('less.builtin.round', 'rounds a number to a number of places'),
'example': 'round(number, [places: 0]);'
},
{
'name': 'sqrt',
'description': localize('less.builtin.sqrt', 'calculates square root of a number'),
'example': 'sqrt(number);'
},
{
'name': 'sin',
'description': localize('less.builtin.sin', 'sine function'),
'example': 'sin(number);'
},
{
'name': 'tan',
'description': localize('less.builtin.tan', 'tangent function'),
'example': 'tan(number);'
},
{
'name': 'atan',
'description': localize('less.builtin.atan', 'arctangent - inverse of tangent function'),
'example': 'atan(number);'
},
{
'name': 'pi',
'description': localize('less.builtin.pi', 'returns pi'),
'example': 'pi();'
},
{
'name': 'pow',
'description': localize('less.builtin.pow', 'first argument raised to the power of the second argument'),
'example': 'pow(@base, @exponent);'
},
{
'name': 'mod',
'description': localize('less.builtin.mod', 'first argument modulus second argument'),
'example': 'mod(number, number);'
},
{
'name': 'min',
'description': localize('less.builtin.min', 'returns the lowest of one or more values'),
'example': 'min(@x, @y);'
},
{
'name': 'max',
'description': localize('less.builtin.max', 'returns the lowest of one or more values'),
'example': 'max(@x, @y);'
}
];
LESSCompletion.colorProposals = [
{
'name': 'argb',
'example': 'argb(@color);',
'description': localize('less.builtin.argb', 'creates a #AARRGGBB')
},
{
'name': 'hsl',
'example': 'hsl(@hue, @saturation, @lightness);',
'description': localize('less.builtin.hsl', 'creates a color')
},
{
'name': 'hsla',
'example': 'hsla(@hue, @saturation, @lightness, @alpha);',
'description': localize('less.builtin.hsla', 'creates a color')
},
{
'name': 'hsv',
'example': 'hsv(@hue, @saturation, @value);',
'description': localize('less.builtin.hsv', 'creates a color')
},
{
'name': 'hsva',
'example': 'hsva(@hue, @saturation, @value, @alpha);',
'description': localize('less.builtin.hsva', 'creates a color')
},
{
'name': 'hue',
'example': 'hue(@color);',
'description': localize('less.builtin.hue', 'returns the `hue` channel of `@color` in the HSL space')
},
{
'name': 'saturation',
'example': 'saturation(@color);',
'description': localize('less.builtin.saturation', 'returns the `saturation` channel of `@color` in the HSL space')
},
{
'name': 'lightness',
'example': 'lightness(@color);',
'description': localize('less.builtin.lightness', 'returns the `lightness` channel of `@color` in the HSL space')
},
{
'name': 'hsvhue',
'example': 'hsvhue(@color);',
'description': localize('less.builtin.hsvhue', 'returns the `hue` channel of `@color` in the HSV space')
},
{
'name': 'hsvsaturation',
'example': 'hsvsaturation(@color);',
'description': localize('less.builtin.hsvsaturation', 'returns the `saturation` channel of `@color` in the HSV space')
},
{
'name': 'hsvvalue',
'example': 'hsvvalue(@color);',
'description': localize('less.builtin.hsvvalue', 'returns the `value` channel of `@color` in the HSV space')
},
{
'name': 'red',
'example': 'red(@color);',
'description': localize('less.builtin.red', 'returns the `red` channel of `@color`')
},
{
'name': 'green',
'example': 'green(@color);',
'description': localize('less.builtin.green', 'returns the `green` channel of `@color`')
},
{
'name': 'blue',
'example': 'blue(@color);',
'description': localize('less.builtin.blue', 'returns the `blue` channel of `@color`')
},
{
'name': 'alpha',
'example': 'alpha(@color);',
'description': localize('less.builtin.alpha', 'returns the `alpha` channel of `@color`')
},
{
'name': 'luma',
'example': 'luma(@color);',
'description': localize('less.builtin.luma', 'returns the `luma` value (perceptual brightness) of `@color`')
},
{
'name': 'saturate',
'example': 'saturate(@color, 10%);',
'description': localize('less.builtin.saturate', 'return `@color` 10% points more saturated')
},
{
'name': 'desaturate',
'example': 'desaturate(@color, 10%);',
'description': localize('less.builtin.desaturate', 'return `@color` 10% points less saturated')
},
{
'name': 'lighten',
'example': 'lighten(@color, 10%);',
'description': localize('less.builtin.lighten', 'return `@color` 10% points lighter')
},
{
'name': 'darken',
'example': 'darken(@color, 10%);',
'description': localize('less.builtin.darken', 'return `@color` 10% points darker')
},
{
'name': 'fadein',
'example': 'fadein(@color, 10%);',
'description': localize('less.builtin.fadein', 'return `@color` 10% points less transparent')
},
{
'name': 'fadeout',
'example': 'fadeout(@color, 10%);',
'description': localize('less.builtin.fadeout', 'return `@color` 10% points more transparent')
},
{
'name': 'fade',
'example': 'fade(@color, 50%);',
'description': localize('less.builtin.fade', 'return `@color` with 50% transparency')
},
{
'name': 'spin',
'example': 'spin(@color, 10);',
'description': localize('less.builtin.spin', 'return `@color` with a 10 degree larger in hue')
},
{
'name': 'mix',
'example': 'mix(@color1, @color2, [@weight: 50%]);',
'description': localize('less.builtin.mix', 'return a mix of `@color1` and `@color2`')
},
{
'name': 'greyscale',
'example': 'greyscale(@color);',
'description': localize('less.builtin.greyscale', 'returns a grey, 100% desaturated color')
},
{
'name': 'contrast',
'example': 'contrast(@color1, [@darkcolor: black], [@lightcolor: white], [@threshold: 43%]);',
'description': localize('less.builtin.contrast', 'return `@darkcolor` if `@color1 is> 43% luma` otherwise return `@lightcolor`, see notes')
},
{
'name': 'multiply',
'example': 'multiply(@color1, @color2);'
},
{
'name': 'screen',
'example': 'screen(@color1, @color2);'
},
{
'name': 'overlay',
'example': 'overlay(@color1, @color2);'
},
{
'name': 'softlight',
'example': 'softlight(@color1, @color2);'
},
{
'name': 'hardlight',
'example': 'hardlight(@color1, @color2);'
},
{
'name': 'difference',
'example': 'difference(@color1, @color2);'
},
{
'name': 'exclusion',
'example': 'exclusion(@color1, @color2);'
},
{
'name': 'average',
'example': 'average(@color1, @color2);'
},
{
'name': 'negation',
'example': 'negation(@color1, @color2);'
}
];
exports.LESSCompletion = LESSCompletion;
});
//# sourceMappingURL=lessCompletion.js.map |