vscode-css-languageservice 5.1.9 → 5.1.10
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/lib/esm/cssLanguageService.js +2 -2
- package/lib/esm/languageFacts/colors.js +15 -2
- package/lib/esm/languageFacts/entry.js +4 -4
- package/lib/esm/parser/cssParser.js +1 -0
- package/lib/esm/services/cssCompletion.js +1 -1
- package/lib/esm/services/cssNavigation.js +39 -12
- package/lib/esm/services/lint.js +1 -1
- package/lib/esm/services/scssCompletion.js +2 -2
- package/lib/esm/services/scssNavigation.js +1 -1
- package/lib/esm/services/selectorPrinting.js +5 -5
- package/lib/umd/cssLanguageService.js +2 -2
- package/lib/umd/languageFacts/colors.js +15 -2
- package/lib/umd/languageFacts/entry.js +4 -4
- package/lib/umd/parser/cssParser.js +1 -0
- package/lib/umd/services/cssCompletion.js +1 -1
- package/lib/umd/services/cssNavigation.js +39 -12
- package/lib/umd/services/lint.js +1 -1
- package/lib/umd/services/scssCompletion.js +2 -2
- package/lib/umd/services/scssNavigation.js +1 -1
- package/lib/umd/services/selectorPrinting.js +5 -5
- package/package.json +9 -9
|
@@ -59,7 +59,7 @@ var defaultLanguageServiceOptions = {};
|
|
|
59
59
|
export function getCSSLanguageService(options) {
|
|
60
60
|
if (options === void 0) { options = defaultLanguageServiceOptions; }
|
|
61
61
|
var cssDataManager = new CSSDataManager(options);
|
|
62
|
-
return createFacade(new Parser(), new CSSCompletion(null, options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
62
|
+
return createFacade(new Parser(), new CSSCompletion(null, options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider, false), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
63
63
|
}
|
|
64
64
|
export function getSCSSLanguageService(options) {
|
|
65
65
|
if (options === void 0) { options = defaultLanguageServiceOptions; }
|
|
@@ -69,5 +69,5 @@ export function getSCSSLanguageService(options) {
|
|
|
69
69
|
export function getLESSLanguageService(options) {
|
|
70
70
|
if (options === void 0) { options = defaultLanguageServiceOptions; }
|
|
71
71
|
var cssDataManager = new CSSDataManager(options);
|
|
72
|
-
return createFacade(new LESSParser(), new LESSCompletion(options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
72
|
+
return createFacade(new LESSParser(), new LESSCompletion(options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider, true), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
73
73
|
}
|
|
@@ -181,9 +181,22 @@ function getNumericValue(node, factor) {
|
|
|
181
181
|
}
|
|
182
182
|
function getAngle(node) {
|
|
183
183
|
var val = node.getText();
|
|
184
|
-
var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg)?$/);
|
|
184
|
+
var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg|rad|grad|turn)?$/);
|
|
185
185
|
if (m) {
|
|
186
|
-
|
|
186
|
+
switch (m[2]) {
|
|
187
|
+
case 'deg':
|
|
188
|
+
return parseFloat(val) % 360;
|
|
189
|
+
case 'rad':
|
|
190
|
+
return (parseFloat(val) * 180 / Math.PI) % 360;
|
|
191
|
+
case 'grad':
|
|
192
|
+
return (parseFloat(val) * 0.9) % 360;
|
|
193
|
+
case 'turn':
|
|
194
|
+
return (parseFloat(val) * 360) % 360;
|
|
195
|
+
default:
|
|
196
|
+
if ('undefined' === typeof m[2]) {
|
|
197
|
+
return parseFloat(val) % 360;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
187
200
|
}
|
|
188
201
|
throw new Error();
|
|
189
202
|
}
|
|
@@ -65,7 +65,7 @@ function getEntryStringDescription(entry, settings) {
|
|
|
65
65
|
result += '\n(' + browserLabel + ')';
|
|
66
66
|
}
|
|
67
67
|
if ('syntax' in entry) {
|
|
68
|
-
result += "\n\nSyntax: "
|
|
68
|
+
result += "\n\nSyntax: ".concat(entry.syntax);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
|
|
@@ -73,7 +73,7 @@ function getEntryStringDescription(entry, settings) {
|
|
|
73
73
|
result += '\n\n';
|
|
74
74
|
}
|
|
75
75
|
result += entry.references.map(function (r) {
|
|
76
|
-
return r.name
|
|
76
|
+
return "".concat(r.name, ": ").concat(r.url);
|
|
77
77
|
}).join(' | ');
|
|
78
78
|
}
|
|
79
79
|
return result;
|
|
@@ -98,7 +98,7 @@ function getEntryMarkdownDescription(entry, settings) {
|
|
|
98
98
|
result += '\n\n(' + textToMarkedString(browserLabel) + ')';
|
|
99
99
|
}
|
|
100
100
|
if ('syntax' in entry && entry.syntax) {
|
|
101
|
-
result += "\n\nSyntax: "
|
|
101
|
+
result += "\n\nSyntax: ".concat(textToMarkedString(entry.syntax));
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
|
|
@@ -106,7 +106,7 @@ function getEntryMarkdownDescription(entry, settings) {
|
|
|
106
106
|
result += '\n\n';
|
|
107
107
|
}
|
|
108
108
|
result += entry.references.map(function (r) {
|
|
109
|
-
return "["
|
|
109
|
+
return "[".concat(r.name, "](").concat(r.url, ")");
|
|
110
110
|
}).join(' | ');
|
|
111
111
|
}
|
|
112
112
|
return result;
|
|
@@ -1259,6 +1259,7 @@ var Parser = /** @class */ (function () {
|
|
|
1259
1259
|
if (node.setOperator(this._parseOperator())) {
|
|
1260
1260
|
node.setValue(this._parseBinaryExpr());
|
|
1261
1261
|
this.acceptIdent('i'); // case insensitive matching
|
|
1262
|
+
this.acceptIdent('s'); // case sensitive matching
|
|
1262
1263
|
}
|
|
1263
1264
|
if (!this.accept(TokenType.BracketR)) {
|
|
1264
1265
|
return this.finish(node, ParseError.RightSquareBracketExpected);
|
|
@@ -457,7 +457,7 @@ var CSSCompletion = /** @class */ (function () {
|
|
|
457
457
|
var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, nodes.ReferenceType.Variable);
|
|
458
458
|
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
|
|
459
459
|
var symbol = symbols_1[_i];
|
|
460
|
-
var insertText = strings.startsWith(symbol.name, '--') ? "var("
|
|
460
|
+
var insertText = strings.startsWith(symbol.name, '--') ? "var(".concat(symbol.name, ")") : symbol.name;
|
|
461
461
|
var completionItem = {
|
|
462
462
|
label: symbol.name,
|
|
463
463
|
documentation: symbol.value ? strings.getLimitedString(symbol.value) : symbol.value,
|
|
@@ -50,8 +50,9 @@ var localize = nls.loadMessageBundle();
|
|
|
50
50
|
var startsWithSchemeRegex = /^\w+:\/\//;
|
|
51
51
|
var startsWithData = /^data:/;
|
|
52
52
|
var CSSNavigation = /** @class */ (function () {
|
|
53
|
-
function CSSNavigation(fileSystemProvider) {
|
|
53
|
+
function CSSNavigation(fileSystemProvider, resolveModuleReferences) {
|
|
54
54
|
this.fileSystemProvider = fileSystemProvider;
|
|
55
|
+
this.resolveModuleReferences = resolveModuleReferences;
|
|
55
56
|
}
|
|
56
57
|
CSSNavigation.prototype.findDefinition = function (document, position, stylesheet) {
|
|
57
58
|
var symbols = new Symbols(stylesheet);
|
|
@@ -281,25 +282,25 @@ var CSSNavigation = /** @class */ (function () {
|
|
|
281
282
|
var red256 = Math.round(color.red * 255), green256 = Math.round(color.green * 255), blue256 = Math.round(color.blue * 255);
|
|
282
283
|
var label;
|
|
283
284
|
if (color.alpha === 1) {
|
|
284
|
-
label = "rgb("
|
|
285
|
+
label = "rgb(".concat(red256, ", ").concat(green256, ", ").concat(blue256, ")");
|
|
285
286
|
}
|
|
286
287
|
else {
|
|
287
|
-
label = "rgba("
|
|
288
|
+
label = "rgba(".concat(red256, ", ").concat(green256, ", ").concat(blue256, ", ").concat(color.alpha, ")");
|
|
288
289
|
}
|
|
289
290
|
result.push({ label: label, textEdit: TextEdit.replace(range, label) });
|
|
290
291
|
if (color.alpha === 1) {
|
|
291
|
-
label = "#"
|
|
292
|
+
label = "#".concat(toTwoDigitHex(red256)).concat(toTwoDigitHex(green256)).concat(toTwoDigitHex(blue256));
|
|
292
293
|
}
|
|
293
294
|
else {
|
|
294
|
-
label = "#"
|
|
295
|
+
label = "#".concat(toTwoDigitHex(red256)).concat(toTwoDigitHex(green256)).concat(toTwoDigitHex(blue256)).concat(toTwoDigitHex(Math.round(color.alpha * 255)));
|
|
295
296
|
}
|
|
296
297
|
result.push({ label: label, textEdit: TextEdit.replace(range, label) });
|
|
297
298
|
var hsl = hslFromColor(color);
|
|
298
299
|
if (hsl.a === 1) {
|
|
299
|
-
label = "hsl("
|
|
300
|
+
label = "hsl(".concat(hsl.h, ", ").concat(Math.round(hsl.s * 100), "%, ").concat(Math.round(hsl.l * 100), "%)");
|
|
300
301
|
}
|
|
301
302
|
else {
|
|
302
|
-
label = "hsla("
|
|
303
|
+
label = "hsla(".concat(hsl.h, ", ").concat(Math.round(hsl.s * 100), "%, ").concat(Math.round(hsl.l * 100), "%, ").concat(hsl.a, ")");
|
|
303
304
|
}
|
|
304
305
|
result.push({ label: label, textEdit: TextEdit.replace(range, label) });
|
|
305
306
|
return result;
|
|
@@ -312,14 +313,12 @@ var CSSNavigation = /** @class */ (function () {
|
|
|
312
313
|
changes: (_a = {}, _a[document.uri] = edits, _a)
|
|
313
314
|
};
|
|
314
315
|
};
|
|
315
|
-
CSSNavigation.prototype.
|
|
316
|
+
CSSNavigation.prototype.resolveModuleReference = function (ref, documentUri, documentContext) {
|
|
316
317
|
return __awaiter(this, void 0, void 0, function () {
|
|
317
318
|
var moduleName, rootFolderUri, documentFolderUri, modulePath, pathWithinModule;
|
|
318
319
|
return __generator(this, function (_a) {
|
|
319
320
|
switch (_a.label) {
|
|
320
321
|
case 0:
|
|
321
|
-
if (!(ref[0] === '~' && ref[1] !== '/' && this.fileSystemProvider)) return [3 /*break*/, 3];
|
|
322
|
-
ref = ref.substring(1);
|
|
323
322
|
if (!startsWith(documentUri, 'file://')) return [3 /*break*/, 2];
|
|
324
323
|
moduleName = getModuleNameFromPath(ref);
|
|
325
324
|
rootFolderUri = documentContext.resolveReference('/', documentUri);
|
|
@@ -332,8 +331,36 @@ var CSSNavigation = /** @class */ (function () {
|
|
|
332
331
|
return [2 /*return*/, joinPath(modulePath, pathWithinModule)];
|
|
333
332
|
}
|
|
334
333
|
_a.label = 2;
|
|
335
|
-
case 2: return [2 /*return*/,
|
|
336
|
-
|
|
334
|
+
case 2: return [2 /*return*/, undefined];
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
CSSNavigation.prototype.resolveRelativeReference = function (ref, documentUri, documentContext, isRawLink) {
|
|
340
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
341
|
+
var relativeReference, _a;
|
|
342
|
+
return __generator(this, function (_b) {
|
|
343
|
+
switch (_b.label) {
|
|
344
|
+
case 0:
|
|
345
|
+
relativeReference = documentContext.resolveReference(ref, documentUri);
|
|
346
|
+
if (!(ref[0] === '~' && ref[1] !== '/' && this.fileSystemProvider)) return [3 /*break*/, 2];
|
|
347
|
+
ref = ref.substring(1);
|
|
348
|
+
return [4 /*yield*/, this.resolveModuleReference(ref, documentUri, documentContext)];
|
|
349
|
+
case 1: return [2 /*return*/, (_b.sent()) || relativeReference];
|
|
350
|
+
case 2:
|
|
351
|
+
if (!this.resolveModuleReferences) return [3 /*break*/, 7];
|
|
352
|
+
_a = relativeReference;
|
|
353
|
+
if (!_a) return [3 /*break*/, 4];
|
|
354
|
+
return [4 /*yield*/, this.fileExists(relativeReference)];
|
|
355
|
+
case 3:
|
|
356
|
+
_a = (_b.sent());
|
|
357
|
+
_b.label = 4;
|
|
358
|
+
case 4:
|
|
359
|
+
if (!_a) return [3 /*break*/, 5];
|
|
360
|
+
return [2 /*return*/, relativeReference];
|
|
361
|
+
case 5: return [4 /*yield*/, this.resolveModuleReference(ref, documentUri, documentContext)];
|
|
362
|
+
case 6: return [2 /*return*/, (_b.sent()) || relativeReference];
|
|
363
|
+
case 7: return [2 /*return*/, relativeReference];
|
|
337
364
|
}
|
|
338
365
|
});
|
|
339
366
|
});
|
package/lib/esm/services/lint.js
CHANGED
|
@@ -162,7 +162,7 @@ var LintVisitor = /** @class */ (function () {
|
|
|
162
162
|
if (atDirective) {
|
|
163
163
|
return false;
|
|
164
164
|
}
|
|
165
|
-
this.addEntry(atRuleName, Rules.UnknownAtRules, "Unknown at rule "
|
|
165
|
+
this.addEntry(atRuleName, Rules.UnknownAtRules, "Unknown at rule ".concat(atRuleName.getText()));
|
|
166
166
|
return true;
|
|
167
167
|
};
|
|
168
168
|
LintVisitor.prototype.visitKeyframe = function (node) {
|
|
@@ -44,7 +44,7 @@ var SCSSCompletion = /** @class */ (function (_super) {
|
|
|
44
44
|
var item = {
|
|
45
45
|
label: p.label,
|
|
46
46
|
documentation: p.documentation,
|
|
47
|
-
textEdit: TextEdit.replace(this.getCompletionRange(importPathNode), "'"
|
|
47
|
+
textEdit: TextEdit.replace(this.getCompletionRange(importPathNode), "'".concat(p.label, "'")),
|
|
48
48
|
kind: CompletionItemKind.Module
|
|
49
49
|
};
|
|
50
50
|
result.items.push(item);
|
|
@@ -369,7 +369,7 @@ function addReferencesToDocumentation(items) {
|
|
|
369
369
|
markdownDoc.value += '\n\n';
|
|
370
370
|
markdownDoc.value += i.references
|
|
371
371
|
.map(function (r) {
|
|
372
|
-
return "["
|
|
372
|
+
return "[".concat(r.name, "](").concat(r.url, ")");
|
|
373
373
|
})
|
|
374
374
|
.join(' | ');
|
|
375
375
|
i.documentation = markdownDoc;
|
|
@@ -61,7 +61,7 @@ import { startsWith } from '../utils/strings';
|
|
|
61
61
|
var SCSSNavigation = /** @class */ (function (_super) {
|
|
62
62
|
__extends(SCSSNavigation, _super);
|
|
63
63
|
function SCSSNavigation(fileSystemProvider) {
|
|
64
|
-
return _super.call(this, fileSystemProvider) || this;
|
|
64
|
+
return _super.call(this, fileSystemProvider, true) || this;
|
|
65
65
|
}
|
|
66
66
|
SCSSNavigation.prototype.isRawStringDocumentLinkNode = function (node) {
|
|
67
67
|
return (_super.prototype.isRawStringDocumentLinkNode.call(this, node) ||
|
|
@@ -291,23 +291,23 @@ export function toElement(node, parentElement) {
|
|
|
291
291
|
switch (unescape(operator.getText())) {
|
|
292
292
|
case '|=':
|
|
293
293
|
// excatly or followed by -words
|
|
294
|
-
value = quotes.remove(unescape(expression.getText()))
|
|
294
|
+
value = "".concat(quotes.remove(unescape(expression.getText())), "-\u2026");
|
|
295
295
|
break;
|
|
296
296
|
case '^=':
|
|
297
297
|
// prefix
|
|
298
|
-
value = quotes.remove(unescape(expression.getText()))
|
|
298
|
+
value = "".concat(quotes.remove(unescape(expression.getText())), "\u2026");
|
|
299
299
|
break;
|
|
300
300
|
case '$=':
|
|
301
301
|
// suffix
|
|
302
|
-
value = "\u2026"
|
|
302
|
+
value = "\u2026".concat(quotes.remove(unescape(expression.getText())));
|
|
303
303
|
break;
|
|
304
304
|
case '~=':
|
|
305
305
|
// one of a list of words
|
|
306
|
-
value = " \u2026 "
|
|
306
|
+
value = " \u2026 ".concat(quotes.remove(unescape(expression.getText())), " \u2026 ");
|
|
307
307
|
break;
|
|
308
308
|
case '*=':
|
|
309
309
|
// substring
|
|
310
|
-
value = "\u2026"
|
|
310
|
+
value = "\u2026".concat(quotes.remove(unescape(expression.getText())), "\u2026");
|
|
311
311
|
break;
|
|
312
312
|
default:
|
|
313
313
|
value = quotes.remove(unescape(expression.getText()));
|
|
@@ -82,7 +82,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
82
82
|
function getCSSLanguageService(options) {
|
|
83
83
|
if (options === void 0) { options = defaultLanguageServiceOptions; }
|
|
84
84
|
var cssDataManager = new dataManager_1.CSSDataManager(options);
|
|
85
|
-
return createFacade(new cssParser_1.Parser(), new cssCompletion_1.CSSCompletion(null, options, cssDataManager), new cssHover_1.CSSHover(options && options.clientCapabilities, cssDataManager), new cssNavigation_1.CSSNavigation(options && options.fileSystemProvider), new cssCodeActions_1.CSSCodeActions(cssDataManager), new cssValidation_1.CSSValidation(cssDataManager), cssDataManager);
|
|
85
|
+
return createFacade(new cssParser_1.Parser(), new cssCompletion_1.CSSCompletion(null, options, cssDataManager), new cssHover_1.CSSHover(options && options.clientCapabilities, cssDataManager), new cssNavigation_1.CSSNavigation(options && options.fileSystemProvider, false), new cssCodeActions_1.CSSCodeActions(cssDataManager), new cssValidation_1.CSSValidation(cssDataManager), cssDataManager);
|
|
86
86
|
}
|
|
87
87
|
exports.getCSSLanguageService = getCSSLanguageService;
|
|
88
88
|
function getSCSSLanguageService(options) {
|
|
@@ -94,7 +94,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
94
94
|
function getLESSLanguageService(options) {
|
|
95
95
|
if (options === void 0) { options = defaultLanguageServiceOptions; }
|
|
96
96
|
var cssDataManager = new dataManager_1.CSSDataManager(options);
|
|
97
|
-
return createFacade(new lessParser_1.LESSParser(), new lessCompletion_1.LESSCompletion(options, cssDataManager), new cssHover_1.CSSHover(options && options.clientCapabilities, cssDataManager), new cssNavigation_1.CSSNavigation(options && options.fileSystemProvider), new cssCodeActions_1.CSSCodeActions(cssDataManager), new cssValidation_1.CSSValidation(cssDataManager), cssDataManager);
|
|
97
|
+
return createFacade(new lessParser_1.LESSParser(), new lessCompletion_1.LESSCompletion(options, cssDataManager), new cssHover_1.CSSHover(options && options.clientCapabilities, cssDataManager), new cssNavigation_1.CSSNavigation(options && options.fileSystemProvider, true), new cssCodeActions_1.CSSCodeActions(cssDataManager), new cssValidation_1.CSSValidation(cssDataManager), cssDataManager);
|
|
98
98
|
}
|
|
99
99
|
exports.getLESSLanguageService = getLESSLanguageService;
|
|
100
100
|
});
|
|
@@ -193,9 +193,22 @@
|
|
|
193
193
|
}
|
|
194
194
|
function getAngle(node) {
|
|
195
195
|
var val = node.getText();
|
|
196
|
-
var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg)?$/);
|
|
196
|
+
var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg|rad|grad|turn)?$/);
|
|
197
197
|
if (m) {
|
|
198
|
-
|
|
198
|
+
switch (m[2]) {
|
|
199
|
+
case 'deg':
|
|
200
|
+
return parseFloat(val) % 360;
|
|
201
|
+
case 'rad':
|
|
202
|
+
return (parseFloat(val) * 180 / Math.PI) % 360;
|
|
203
|
+
case 'grad':
|
|
204
|
+
return (parseFloat(val) * 0.9) % 360;
|
|
205
|
+
case 'turn':
|
|
206
|
+
return (parseFloat(val) * 360) % 360;
|
|
207
|
+
default:
|
|
208
|
+
if ('undefined' === typeof m[2]) {
|
|
209
|
+
return parseFloat(val) % 360;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
199
212
|
}
|
|
200
213
|
throw new Error();
|
|
201
214
|
}
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
result += '\n(' + browserLabel + ')';
|
|
79
79
|
}
|
|
80
80
|
if ('syntax' in entry) {
|
|
81
|
-
result += "\n\nSyntax: "
|
|
81
|
+
result += "\n\nSyntax: ".concat(entry.syntax);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
result += '\n\n';
|
|
87
87
|
}
|
|
88
88
|
result += entry.references.map(function (r) {
|
|
89
|
-
return r.name
|
|
89
|
+
return "".concat(r.name, ": ").concat(r.url);
|
|
90
90
|
}).join(' | ');
|
|
91
91
|
}
|
|
92
92
|
return result;
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
result += '\n\n(' + textToMarkedString(browserLabel) + ')';
|
|
112
112
|
}
|
|
113
113
|
if ('syntax' in entry && entry.syntax) {
|
|
114
|
-
result += "\n\nSyntax: "
|
|
114
|
+
result += "\n\nSyntax: ".concat(textToMarkedString(entry.syntax));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
result += '\n\n';
|
|
120
120
|
}
|
|
121
121
|
result += entry.references.map(function (r) {
|
|
122
|
-
return "["
|
|
122
|
+
return "[".concat(r.name, "](").concat(r.url, ")");
|
|
123
123
|
}).join(' | ');
|
|
124
124
|
}
|
|
125
125
|
return result;
|
|
@@ -1270,6 +1270,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1270
1270
|
if (node.setOperator(this._parseOperator())) {
|
|
1271
1271
|
node.setValue(this._parseBinaryExpr());
|
|
1272
1272
|
this.acceptIdent('i'); // case insensitive matching
|
|
1273
|
+
this.acceptIdent('s'); // case sensitive matching
|
|
1273
1274
|
}
|
|
1274
1275
|
if (!this.accept(cssScanner_1.TokenType.BracketR)) {
|
|
1275
1276
|
return this.finish(node, cssErrors_1.ParseError.RightSquareBracketExpected);
|
|
@@ -468,7 +468,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
468
468
|
var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, nodes.ReferenceType.Variable);
|
|
469
469
|
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
|
|
470
470
|
var symbol = symbols_1[_i];
|
|
471
|
-
var insertText = strings.startsWith(symbol.name, '--') ? "var("
|
|
471
|
+
var insertText = strings.startsWith(symbol.name, '--') ? "var(".concat(symbol.name, ")") : symbol.name;
|
|
472
472
|
var completionItem = {
|
|
473
473
|
label: symbol.name,
|
|
474
474
|
documentation: symbol.value ? strings.getLimitedString(symbol.value) : symbol.value,
|
|
@@ -61,8 +61,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
61
61
|
var startsWithSchemeRegex = /^\w+:\/\//;
|
|
62
62
|
var startsWithData = /^data:/;
|
|
63
63
|
var CSSNavigation = /** @class */ (function () {
|
|
64
|
-
function CSSNavigation(fileSystemProvider) {
|
|
64
|
+
function CSSNavigation(fileSystemProvider, resolveModuleReferences) {
|
|
65
65
|
this.fileSystemProvider = fileSystemProvider;
|
|
66
|
+
this.resolveModuleReferences = resolveModuleReferences;
|
|
66
67
|
}
|
|
67
68
|
CSSNavigation.prototype.findDefinition = function (document, position, stylesheet) {
|
|
68
69
|
var symbols = new cssSymbolScope_1.Symbols(stylesheet);
|
|
@@ -292,25 +293,25 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
292
293
|
var red256 = Math.round(color.red * 255), green256 = Math.round(color.green * 255), blue256 = Math.round(color.blue * 255);
|
|
293
294
|
var label;
|
|
294
295
|
if (color.alpha === 1) {
|
|
295
|
-
label = "rgb("
|
|
296
|
+
label = "rgb(".concat(red256, ", ").concat(green256, ", ").concat(blue256, ")");
|
|
296
297
|
}
|
|
297
298
|
else {
|
|
298
|
-
label = "rgba("
|
|
299
|
+
label = "rgba(".concat(red256, ", ").concat(green256, ", ").concat(blue256, ", ").concat(color.alpha, ")");
|
|
299
300
|
}
|
|
300
301
|
result.push({ label: label, textEdit: cssLanguageTypes_1.TextEdit.replace(range, label) });
|
|
301
302
|
if (color.alpha === 1) {
|
|
302
|
-
label = "#"
|
|
303
|
+
label = "#".concat(toTwoDigitHex(red256)).concat(toTwoDigitHex(green256)).concat(toTwoDigitHex(blue256));
|
|
303
304
|
}
|
|
304
305
|
else {
|
|
305
|
-
label = "#"
|
|
306
|
+
label = "#".concat(toTwoDigitHex(red256)).concat(toTwoDigitHex(green256)).concat(toTwoDigitHex(blue256)).concat(toTwoDigitHex(Math.round(color.alpha * 255)));
|
|
306
307
|
}
|
|
307
308
|
result.push({ label: label, textEdit: cssLanguageTypes_1.TextEdit.replace(range, label) });
|
|
308
309
|
var hsl = (0, facts_1.hslFromColor)(color);
|
|
309
310
|
if (hsl.a === 1) {
|
|
310
|
-
label = "hsl("
|
|
311
|
+
label = "hsl(".concat(hsl.h, ", ").concat(Math.round(hsl.s * 100), "%, ").concat(Math.round(hsl.l * 100), "%)");
|
|
311
312
|
}
|
|
312
313
|
else {
|
|
313
|
-
label = "hsla("
|
|
314
|
+
label = "hsla(".concat(hsl.h, ", ").concat(Math.round(hsl.s * 100), "%, ").concat(Math.round(hsl.l * 100), "%, ").concat(hsl.a, ")");
|
|
314
315
|
}
|
|
315
316
|
result.push({ label: label, textEdit: cssLanguageTypes_1.TextEdit.replace(range, label) });
|
|
316
317
|
return result;
|
|
@@ -323,14 +324,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
323
324
|
changes: (_a = {}, _a[document.uri] = edits, _a)
|
|
324
325
|
};
|
|
325
326
|
};
|
|
326
|
-
CSSNavigation.prototype.
|
|
327
|
+
CSSNavigation.prototype.resolveModuleReference = function (ref, documentUri, documentContext) {
|
|
327
328
|
return __awaiter(this, void 0, void 0, function () {
|
|
328
329
|
var moduleName, rootFolderUri, documentFolderUri, modulePath, pathWithinModule;
|
|
329
330
|
return __generator(this, function (_a) {
|
|
330
331
|
switch (_a.label) {
|
|
331
332
|
case 0:
|
|
332
|
-
if (!(ref[0] === '~' && ref[1] !== '/' && this.fileSystemProvider)) return [3 /*break*/, 3];
|
|
333
|
-
ref = ref.substring(1);
|
|
334
333
|
if (!(0, strings_1.startsWith)(documentUri, 'file://')) return [3 /*break*/, 2];
|
|
335
334
|
moduleName = getModuleNameFromPath(ref);
|
|
336
335
|
rootFolderUri = documentContext.resolveReference('/', documentUri);
|
|
@@ -343,8 +342,36 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
343
342
|
return [2 /*return*/, (0, resources_1.joinPath)(modulePath, pathWithinModule)];
|
|
344
343
|
}
|
|
345
344
|
_a.label = 2;
|
|
346
|
-
case 2: return [2 /*return*/,
|
|
347
|
-
|
|
345
|
+
case 2: return [2 /*return*/, undefined];
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
CSSNavigation.prototype.resolveRelativeReference = function (ref, documentUri, documentContext, isRawLink) {
|
|
351
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
352
|
+
var relativeReference, _a;
|
|
353
|
+
return __generator(this, function (_b) {
|
|
354
|
+
switch (_b.label) {
|
|
355
|
+
case 0:
|
|
356
|
+
relativeReference = documentContext.resolveReference(ref, documentUri);
|
|
357
|
+
if (!(ref[0] === '~' && ref[1] !== '/' && this.fileSystemProvider)) return [3 /*break*/, 2];
|
|
358
|
+
ref = ref.substring(1);
|
|
359
|
+
return [4 /*yield*/, this.resolveModuleReference(ref, documentUri, documentContext)];
|
|
360
|
+
case 1: return [2 /*return*/, (_b.sent()) || relativeReference];
|
|
361
|
+
case 2:
|
|
362
|
+
if (!this.resolveModuleReferences) return [3 /*break*/, 7];
|
|
363
|
+
_a = relativeReference;
|
|
364
|
+
if (!_a) return [3 /*break*/, 4];
|
|
365
|
+
return [4 /*yield*/, this.fileExists(relativeReference)];
|
|
366
|
+
case 3:
|
|
367
|
+
_a = (_b.sent());
|
|
368
|
+
_b.label = 4;
|
|
369
|
+
case 4:
|
|
370
|
+
if (!_a) return [3 /*break*/, 5];
|
|
371
|
+
return [2 /*return*/, relativeReference];
|
|
372
|
+
case 5: return [4 /*yield*/, this.resolveModuleReference(ref, documentUri, documentContext)];
|
|
373
|
+
case 6: return [2 /*return*/, (_b.sent()) || relativeReference];
|
|
374
|
+
case 7: return [2 /*return*/, relativeReference];
|
|
348
375
|
}
|
|
349
376
|
});
|
|
350
377
|
});
|
package/lib/umd/services/lint.js
CHANGED
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
if (atDirective) {
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
176
|
-
this.addEntry(atRuleName, lintRules_1.Rules.UnknownAtRules, "Unknown at rule "
|
|
176
|
+
this.addEntry(atRuleName, lintRules_1.Rules.UnknownAtRules, "Unknown at rule ".concat(atRuleName.getText()));
|
|
177
177
|
return true;
|
|
178
178
|
};
|
|
179
179
|
LintVisitor.prototype.visitKeyframe = function (node) {
|
|
@@ -55,7 +55,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
55
55
|
var item = {
|
|
56
56
|
label: p.label,
|
|
57
57
|
documentation: p.documentation,
|
|
58
|
-
textEdit: cssLanguageTypes_1.TextEdit.replace(this.getCompletionRange(importPathNode), "'"
|
|
58
|
+
textEdit: cssLanguageTypes_1.TextEdit.replace(this.getCompletionRange(importPathNode), "'".concat(p.label, "'")),
|
|
59
59
|
kind: cssLanguageTypes_1.CompletionItemKind.Module
|
|
60
60
|
};
|
|
61
61
|
result.items.push(item);
|
|
@@ -380,7 +380,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
380
380
|
markdownDoc.value += '\n\n';
|
|
381
381
|
markdownDoc.value += i.references
|
|
382
382
|
.map(function (r) {
|
|
383
|
-
return "["
|
|
383
|
+
return "[".concat(r.name, "](").concat(r.url, ")");
|
|
384
384
|
})
|
|
385
385
|
.join(' | ');
|
|
386
386
|
i.documentation = markdownDoc;
|
|
@@ -72,7 +72,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
72
72
|
var SCSSNavigation = /** @class */ (function (_super) {
|
|
73
73
|
__extends(SCSSNavigation, _super);
|
|
74
74
|
function SCSSNavigation(fileSystemProvider) {
|
|
75
|
-
return _super.call(this, fileSystemProvider) || this;
|
|
75
|
+
return _super.call(this, fileSystemProvider, true) || this;
|
|
76
76
|
}
|
|
77
77
|
SCSSNavigation.prototype.isRawStringDocumentLinkNode = function (node) {
|
|
78
78
|
return (_super.prototype.isRawStringDocumentLinkNode.call(this, node) ||
|
|
@@ -302,23 +302,23 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
302
302
|
switch (unescape(operator.getText())) {
|
|
303
303
|
case '|=':
|
|
304
304
|
// excatly or followed by -words
|
|
305
|
-
value = quotes.remove(unescape(expression.getText()))
|
|
305
|
+
value = "".concat(quotes.remove(unescape(expression.getText())), "-\u2026");
|
|
306
306
|
break;
|
|
307
307
|
case '^=':
|
|
308
308
|
// prefix
|
|
309
|
-
value = quotes.remove(unescape(expression.getText()))
|
|
309
|
+
value = "".concat(quotes.remove(unescape(expression.getText())), "\u2026");
|
|
310
310
|
break;
|
|
311
311
|
case '$=':
|
|
312
312
|
// suffix
|
|
313
|
-
value = "\u2026"
|
|
313
|
+
value = "\u2026".concat(quotes.remove(unescape(expression.getText())));
|
|
314
314
|
break;
|
|
315
315
|
case '~=':
|
|
316
316
|
// one of a list of words
|
|
317
|
-
value = " \u2026 "
|
|
317
|
+
value = " \u2026 ".concat(quotes.remove(unescape(expression.getText())), " \u2026 ");
|
|
318
318
|
break;
|
|
319
319
|
case '*=':
|
|
320
320
|
// substring
|
|
321
|
-
value = "\u2026"
|
|
321
|
+
value = "\u2026".concat(quotes.remove(unescape(expression.getText())), "\u2026");
|
|
322
322
|
break;
|
|
323
323
|
default:
|
|
324
324
|
value = quotes.remove(unescape(expression.getText()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-css-languageservice",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.10",
|
|
4
4
|
"description": "Language service for CSS, LESS and SCSS",
|
|
5
5
|
"main": "./lib/umd/cssLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/cssLanguageService",
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"url": "https://github.com/Microsoft/vscode-css-languageservice"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/mocha": "^9.
|
|
18
|
+
"@types/mocha": "^9.1.0",
|
|
19
19
|
"@types/node": "^10.12.21",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
21
|
-
"@typescript-eslint/parser": "^
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
|
21
|
+
"@typescript-eslint/parser": "^5.10.1",
|
|
22
|
+
"@vscode/web-custom-data": "^0.3.6",
|
|
23
|
+
"eslint": "^8.7.0",
|
|
24
|
+
"mocha": "^9.2.0",
|
|
24
25
|
"rimraf": "^3.0.2",
|
|
25
|
-
"typescript": "^4.
|
|
26
|
-
"vscode-web-custom-data": "^0.3.5"
|
|
26
|
+
"typescript": "^4.5.5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"vscode-languageserver-textdocument": "^1.0.1",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"mocha": "mocha",
|
|
44
44
|
"coverage": "npm run compile && npx nyc --reporter=html --reporter=text mocha",
|
|
45
45
|
"lint": "eslint src/**/*.ts",
|
|
46
|
-
"update-data": "yarn add vscode
|
|
46
|
+
"update-data": "yarn add @vscode/web-custom-data -D && node ./build/generateData.js",
|
|
47
47
|
"install-types-next": "yarn add vscode-languageserver-types@next -f -S && yarn add vscode-languageserver-textdocument@next -f -S",
|
|
48
48
|
"preversion": "npm test",
|
|
49
49
|
"postversion": "git push && git push --tags"
|