vscode-css-languageservice 5.1.7 → 5.1.11
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/data/webCustomData.js +171 -150
- package/lib/esm/languageFacts/colors.js +30 -2
- package/lib/esm/languageFacts/entry.js +11 -6
- package/lib/esm/parser/cssNodes.js +94 -46
- package/lib/esm/parser/cssParser.js +108 -28
- package/lib/esm/parser/lessParser.js +2 -2
- package/lib/esm/parser/scssParser.js +2 -2
- package/lib/esm/services/cssCompletion.js +45 -31
- 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/data/webCustomData.js +171 -150
- package/lib/umd/languageFacts/colors.js +30 -2
- package/lib/umd/languageFacts/entry.js +12 -7
- package/lib/umd/parser/cssNodes.js +95 -47
- package/lib/umd/parser/cssParser.js +108 -28
- package/lib/umd/parser/lessParser.js +2 -2
- package/lib/umd/parser/scssParser.js +2 -2
- package/lib/umd/services/cssCompletion.js +45 -31
- 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
|
@@ -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.11",
|
|
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"
|