vscode-css-languageservice 5.1.13 → 5.4.1
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 +14 -0
- package/lib/esm/beautify/beautify-css.js +1605 -0
- package/lib/esm/cssLanguageService.d.ts +2 -1
- package/lib/esm/cssLanguageService.js +2 -0
- package/lib/esm/cssLanguageTypes.d.ts +26 -0
- package/lib/esm/data/webCustomData.js +145 -139
- package/lib/esm/parser/cssNodes.js +28 -0
- package/lib/esm/parser/cssParser.js +24 -1
- package/lib/esm/parser/cssScanner.js +36 -0
- package/lib/esm/services/cssFormatter.js +136 -0
- package/lib/esm/utils/strings.js +11 -0
- package/lib/umd/beautify/beautify-css.js +1628 -0
- package/lib/umd/cssLanguageService.d.ts +2 -1
- package/lib/umd/cssLanguageService.js +3 -1
- package/lib/umd/cssLanguageTypes.d.ts +26 -0
- package/lib/umd/data/webCustomData.js +145 -139
- package/lib/umd/parser/cssNodes.js +29 -1
- package/lib/umd/parser/cssParser.js +24 -1
- package/lib/umd/parser/cssScanner.js +36 -0
- package/lib/umd/services/cssFormatter.js +150 -0
- package/lib/umd/utils/strings.js +13 -1
- package/package.json +14 -10
- package/thirdpartynotices.txt +29 -0
|
@@ -28,7 +28,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
28
28
|
*--------------------------------------------------------------------------------------------*/
|
|
29
29
|
'use strict';
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.ParseErrorCollector = exports.Marker = exports.Level = exports.Module = exports.GuardCondition = exports.LessGuard = exports.ListEntry = exports.UnknownAtRule = exports.MixinDeclaration = exports.MixinReference = exports.MixinContentDeclaration = exports.MixinContentReference = exports.ExtendsReference = exports.Variable = exports.Interpolation = exports.VariableDeclaration = exports.NumericValue = exports.RatioValue = exports.HexColorValue = exports.Operator = exports.AttributeSelector = exports.Term = exports.BinaryExpression = exports.Expression = exports.PageBoxMarginBox = exports.Page = exports.SupportsCondition = exports.MediaFeature = exports.MediaCondition = exports.MediaQuery = exports.Medialist = exports.Document = exports.Supports = exports.Media = exports.Namespace = exports.ForwardVisibility = exports.Forward = exports.ModuleConfiguration = exports.Use = exports.Import = exports.KeyframeSelector = exports.Keyframe = exports.NestedProperties = exports.FontFace = exports.ViewPort = exports.FunctionDeclaration = exports.ElseStatement = exports.WhileStatement = exports.EachStatement = exports.ForStatement = exports.IfStatement = exports.FunctionArgument = exports.FunctionParameter = exports.Function = exports.Invocation = exports.Property = exports.CustomPropertyDeclaration = exports.Declaration = exports.CustomPropertySet = exports.AbstractDeclaration = exports.AtApplyRule = exports.SimpleSelector = exports.Selector = exports.RuleSet = exports.BodyDeclaration = exports.Declarations = exports.Stylesheet = exports.Identifier = exports.Nodelist = exports.Node = exports.getParentDeclaration = exports.getNodePath = exports.getNodeAtOffset = exports.ReferenceType = exports.NodeType = void 0;
|
|
31
|
+
exports.ParseErrorCollector = exports.Marker = exports.Level = exports.Module = exports.GuardCondition = exports.LessGuard = exports.ListEntry = exports.UnknownAtRule = exports.MixinDeclaration = exports.MixinReference = exports.MixinContentDeclaration = exports.MixinContentReference = exports.ExtendsReference = exports.Variable = exports.Interpolation = exports.VariableDeclaration = exports.NumericValue = exports.RatioValue = exports.HexColorValue = exports.Operator = exports.AttributeSelector = exports.Term = exports.BinaryExpression = exports.Expression = exports.PageBoxMarginBox = exports.Page = exports.SupportsCondition = exports.MediaFeature = exports.MediaCondition = exports.MediaQuery = exports.Medialist = exports.Document = exports.Supports = exports.Media = exports.Namespace = exports.ForwardVisibility = exports.Forward = exports.ModuleConfiguration = exports.Use = exports.Import = exports.KeyframeSelector = exports.Keyframe = exports.NestedProperties = exports.FontFace = exports.ViewPort = exports.FunctionDeclaration = exports.ElseStatement = exports.WhileStatement = exports.EachStatement = exports.ForStatement = exports.IfStatement = exports.FunctionArgument = exports.FunctionParameter = exports.Function = exports.Invocation = exports.Property = exports.CustomPropertyDeclaration = exports.Declaration = exports.CustomPropertySet = exports.AbstractDeclaration = exports.AtApplyRule = exports.SimpleSelector = exports.Selector = exports.RuleSet = exports.BodyDeclaration = exports.Declarations = exports.Stylesheet = exports.Identifier = exports.UnicodeRange = exports.Nodelist = exports.Node = exports.getParentDeclaration = exports.getNodePath = exports.getNodeAtOffset = exports.ReferenceType = exports.NodeType = void 0;
|
|
32
32
|
var strings_1 = require("../utils/strings");
|
|
33
33
|
/// <summary>
|
|
34
34
|
/// Nodes for the css 2.1 specification. See for reference:
|
|
@@ -118,6 +118,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
118
118
|
NodeType[NodeType["Forward"] = 79] = "Forward";
|
|
119
119
|
NodeType[NodeType["ForwardVisibility"] = 80] = "ForwardVisibility";
|
|
120
120
|
NodeType[NodeType["Module"] = 81] = "Module";
|
|
121
|
+
NodeType[NodeType["UnicodeRange"] = 82] = "UnicodeRange";
|
|
121
122
|
})(NodeType = exports.NodeType || (exports.NodeType = {}));
|
|
122
123
|
var ReferenceType;
|
|
123
124
|
(function (ReferenceType) {
|
|
@@ -408,6 +409,33 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
408
409
|
return Nodelist;
|
|
409
410
|
}(Node));
|
|
410
411
|
exports.Nodelist = Nodelist;
|
|
412
|
+
var UnicodeRange = /** @class */ (function (_super) {
|
|
413
|
+
__extends(UnicodeRange, _super);
|
|
414
|
+
function UnicodeRange(offset, length) {
|
|
415
|
+
return _super.call(this, offset, length) || this;
|
|
416
|
+
}
|
|
417
|
+
Object.defineProperty(UnicodeRange.prototype, "type", {
|
|
418
|
+
get: function () {
|
|
419
|
+
return NodeType.UnicodeRange;
|
|
420
|
+
},
|
|
421
|
+
enumerable: false,
|
|
422
|
+
configurable: true
|
|
423
|
+
});
|
|
424
|
+
UnicodeRange.prototype.setRangeStart = function (rangeStart) {
|
|
425
|
+
return this.setNode('rangeStart', rangeStart);
|
|
426
|
+
};
|
|
427
|
+
UnicodeRange.prototype.getRangeStart = function () {
|
|
428
|
+
return this.rangeStart;
|
|
429
|
+
};
|
|
430
|
+
UnicodeRange.prototype.setRangeEnd = function (rangeEnd) {
|
|
431
|
+
return this.setNode('rangeEnd', rangeEnd);
|
|
432
|
+
};
|
|
433
|
+
UnicodeRange.prototype.getRangeEnd = function () {
|
|
434
|
+
return this.rangeEnd;
|
|
435
|
+
};
|
|
436
|
+
return UnicodeRange;
|
|
437
|
+
}(Node));
|
|
438
|
+
exports.UnicodeRange = UnicodeRange;
|
|
411
439
|
var Identifier = /** @class */ (function (_super) {
|
|
412
440
|
__extends(Identifier, _super);
|
|
413
441
|
function Identifier(offset, length) {
|
|
@@ -73,6 +73,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
73
73
|
this.prevToken = this.token;
|
|
74
74
|
this.token = this.scanner.scan();
|
|
75
75
|
};
|
|
76
|
+
Parser.prototype.acceptUnicodeRange = function () {
|
|
77
|
+
var token = this.scanner.tryScanUnicode();
|
|
78
|
+
if (token) {
|
|
79
|
+
this.prevToken = token;
|
|
80
|
+
this.token = this.scanner.scan();
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
};
|
|
76
85
|
Parser.prototype.mark = function () {
|
|
77
86
|
return {
|
|
78
87
|
prev: this.prevToken,
|
|
@@ -327,7 +336,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
327
336
|
return this._parseUnknownAtRule();
|
|
328
337
|
};
|
|
329
338
|
Parser.prototype._parseRuleSetDeclaration = function () {
|
|
330
|
-
// https://www.w3.org/TR/css-syntax-3/#consume-a-list-of-
|
|
339
|
+
// https://www.w3.org/TR/css-syntax-3/#consume-a-list-of-declarations
|
|
331
340
|
if (this.peek(cssScanner_1.TokenType.AtKeyword)) {
|
|
332
341
|
return this._parseRuleSetDeclarationAtStatement();
|
|
333
342
|
}
|
|
@@ -1355,12 +1364,25 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1355
1364
|
}
|
|
1356
1365
|
this.consumeToken();
|
|
1357
1366
|
}
|
|
1367
|
+
else if (!this.hasWhitespace()) {
|
|
1368
|
+
break;
|
|
1369
|
+
}
|
|
1358
1370
|
if (!node.addChild(this._parseBinaryExpr())) {
|
|
1359
1371
|
break;
|
|
1360
1372
|
}
|
|
1361
1373
|
}
|
|
1362
1374
|
return this.finish(node);
|
|
1363
1375
|
};
|
|
1376
|
+
Parser.prototype._parseUnicodeRange = function () {
|
|
1377
|
+
if (!this.peekIdent('u')) {
|
|
1378
|
+
return null;
|
|
1379
|
+
}
|
|
1380
|
+
var node = this.create(nodes.UnicodeRange);
|
|
1381
|
+
if (!this.acceptUnicodeRange()) {
|
|
1382
|
+
return null;
|
|
1383
|
+
}
|
|
1384
|
+
return this.finish(node);
|
|
1385
|
+
};
|
|
1364
1386
|
Parser.prototype._parseNamedLine = function () {
|
|
1365
1387
|
// https://www.w3.org/TR/css-grid-1/#named-lines
|
|
1366
1388
|
if (!this.peek(cssScanner_1.TokenType.BracketL)) {
|
|
@@ -1405,6 +1427,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
1405
1427
|
};
|
|
1406
1428
|
Parser.prototype._parseTermExpression = function () {
|
|
1407
1429
|
return this._parseURILiteral() || // url before function
|
|
1430
|
+
this._parseUnicodeRange() ||
|
|
1408
1431
|
this._parseFunction() || // function before ident
|
|
1409
1432
|
this._parseIdent() ||
|
|
1410
1433
|
this._parseStringLiteral() ||
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
var _a = 'a'.charCodeAt(0);
|
|
130
130
|
var _f = 'f'.charCodeAt(0);
|
|
131
131
|
var _z = 'z'.charCodeAt(0);
|
|
132
|
+
var _u = 'u'.charCodeAt(0);
|
|
132
133
|
var _A = 'A'.charCodeAt(0);
|
|
133
134
|
var _F = 'F'.charCodeAt(0);
|
|
134
135
|
var _Z = 'Z'.charCodeAt(0);
|
|
@@ -167,6 +168,8 @@
|
|
|
167
168
|
var _CMA = ','.charCodeAt(0);
|
|
168
169
|
var _DOT = '.'.charCodeAt(0);
|
|
169
170
|
var _BNG = '!'.charCodeAt(0);
|
|
171
|
+
var _QSM = '?'.charCodeAt(0);
|
|
172
|
+
var _PLS = '+'.charCodeAt(0);
|
|
170
173
|
var staticTokenTable = {};
|
|
171
174
|
staticTokenTable[_SEM] = TokenType.SemiColon;
|
|
172
175
|
staticTokenTable[_COL] = TokenType.Colon;
|
|
@@ -245,6 +248,19 @@
|
|
|
245
248
|
}
|
|
246
249
|
return this.scanNext(offset);
|
|
247
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* Read the range as described in https://www.w3.org/TR/CSS21/syndata.html#tokenization
|
|
253
|
+
* Assume the `u` has aleady been consumed
|
|
254
|
+
* @returns if reading the unicode was successful
|
|
255
|
+
*/
|
|
256
|
+
Scanner.prototype.tryScanUnicode = function () {
|
|
257
|
+
var offset = this.stream.pos();
|
|
258
|
+
if (!this.stream.eos() && this._unicodeRange()) {
|
|
259
|
+
return this.finishToken(offset, TokenType.UnicodeRange);
|
|
260
|
+
}
|
|
261
|
+
this.stream.goBackTo(offset);
|
|
262
|
+
return undefined;
|
|
263
|
+
};
|
|
248
264
|
Scanner.prototype.scanNext = function (offset) {
|
|
249
265
|
// CDO <!--
|
|
250
266
|
if (this.stream.advanceIfChars([_LAN, _BNG, _MIN, _MIN])) {
|
|
@@ -569,6 +585,26 @@
|
|
|
569
585
|
}
|
|
570
586
|
return false;
|
|
571
587
|
};
|
|
588
|
+
Scanner.prototype._unicodeRange = function () {
|
|
589
|
+
// follow https://www.w3.org/TR/CSS21/syndata.html#tokenization and https://www.w3.org/TR/css-syntax-3/#urange-syntax
|
|
590
|
+
// assume u has already been parsed
|
|
591
|
+
if (this.stream.advanceIfChar(_PLS)) {
|
|
592
|
+
var isHexDigit = function (ch) { return (ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F); };
|
|
593
|
+
var codePoints = this.stream.advanceWhileChar(isHexDigit) + this.stream.advanceWhileChar(function (ch) { return ch === _QSM; });
|
|
594
|
+
if (codePoints >= 1 && codePoints <= 6) {
|
|
595
|
+
if (this.stream.advanceIfChar(_MIN)) {
|
|
596
|
+
var digits = this.stream.advanceWhileChar(isHexDigit);
|
|
597
|
+
if (digits >= 1 && digits <= 6) {
|
|
598
|
+
return true;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return false;
|
|
607
|
+
};
|
|
572
608
|
return Scanner;
|
|
573
609
|
}());
|
|
574
610
|
exports.Scanner = Scanner;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
(function (factory) {
|
|
6
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
7
|
+
var v = factory(require, exports);
|
|
8
|
+
if (v !== undefined) module.exports = v;
|
|
9
|
+
}
|
|
10
|
+
else if (typeof define === "function" && define.amd) {
|
|
11
|
+
define(["require", "exports", "../cssLanguageTypes", "../beautify/beautify-css", "../utils/strings"], factory);
|
|
12
|
+
}
|
|
13
|
+
})(function (require, exports) {
|
|
14
|
+
"use strict";
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.format = void 0;
|
|
17
|
+
var cssLanguageTypes_1 = require("../cssLanguageTypes");
|
|
18
|
+
var beautify_css_1 = require("../beautify/beautify-css");
|
|
19
|
+
var strings_1 = require("../utils/strings");
|
|
20
|
+
function format(document, range, options) {
|
|
21
|
+
var value = document.getText();
|
|
22
|
+
var includesEnd = true;
|
|
23
|
+
var initialIndentLevel = 0;
|
|
24
|
+
var inRule = false;
|
|
25
|
+
var tabSize = options.tabSize || 4;
|
|
26
|
+
if (range) {
|
|
27
|
+
var startOffset = document.offsetAt(range.start);
|
|
28
|
+
// include all leading whitespace iff at the beginning of the line
|
|
29
|
+
var extendedStart = startOffset;
|
|
30
|
+
while (extendedStart > 0 && isWhitespace(value, extendedStart - 1)) {
|
|
31
|
+
extendedStart--;
|
|
32
|
+
}
|
|
33
|
+
if (extendedStart === 0 || isEOL(value, extendedStart - 1)) {
|
|
34
|
+
startOffset = extendedStart;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// else keep at least one whitespace
|
|
38
|
+
if (extendedStart < startOffset) {
|
|
39
|
+
startOffset = extendedStart + 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// include all following whitespace until the end of the line
|
|
43
|
+
var endOffset = document.offsetAt(range.end);
|
|
44
|
+
var extendedEnd = endOffset;
|
|
45
|
+
while (extendedEnd < value.length && isWhitespace(value, extendedEnd)) {
|
|
46
|
+
extendedEnd++;
|
|
47
|
+
}
|
|
48
|
+
if (extendedEnd === value.length || isEOL(value, extendedEnd)) {
|
|
49
|
+
endOffset = extendedEnd;
|
|
50
|
+
}
|
|
51
|
+
range = cssLanguageTypes_1.Range.create(document.positionAt(startOffset), document.positionAt(endOffset));
|
|
52
|
+
// Test if inside a rule
|
|
53
|
+
inRule = isInRule(value, startOffset);
|
|
54
|
+
includesEnd = endOffset === value.length;
|
|
55
|
+
value = value.substring(startOffset, endOffset);
|
|
56
|
+
if (startOffset !== 0) {
|
|
57
|
+
var startOfLineOffset = document.offsetAt(cssLanguageTypes_1.Position.create(range.start.line, 0));
|
|
58
|
+
initialIndentLevel = computeIndentLevel(document.getText(), startOfLineOffset, options);
|
|
59
|
+
}
|
|
60
|
+
if (inRule) {
|
|
61
|
+
value = "{\n".concat(trimLeft(value));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
range = cssLanguageTypes_1.Range.create(cssLanguageTypes_1.Position.create(0, 0), document.positionAt(value.length));
|
|
66
|
+
}
|
|
67
|
+
var cssOptions = {
|
|
68
|
+
indent_size: tabSize,
|
|
69
|
+
indent_char: options.insertSpaces ? ' ' : '\t',
|
|
70
|
+
end_with_newline: includesEnd && getFormatOption(options, 'insertFinalNewline', false),
|
|
71
|
+
selector_separator_newline: getFormatOption(options, 'newlineBetweenSelectors', true),
|
|
72
|
+
newline_between_rules: getFormatOption(options, 'newlineBetweenRules', true),
|
|
73
|
+
space_around_selector_separator: getFormatOption(options, 'spaceAroundSelectorSeparator', false),
|
|
74
|
+
brace_style: getFormatOption(options, 'braceStyle', 'collapse'),
|
|
75
|
+
indent_empty_lines: getFormatOption(options, 'indentEmptyLines', false),
|
|
76
|
+
max_preserve_newlines: getFormatOption(options, 'maxPreserveNewLines', undefined),
|
|
77
|
+
preserve_newlines: getFormatOption(options, 'preserveNewLines', true),
|
|
78
|
+
wrap_line_length: getFormatOption(options, 'wrapLineLength', undefined),
|
|
79
|
+
eol: '\n'
|
|
80
|
+
};
|
|
81
|
+
var result = (0, beautify_css_1.css_beautify)(value, cssOptions);
|
|
82
|
+
if (inRule) {
|
|
83
|
+
result = trimLeft(result.substring(2));
|
|
84
|
+
}
|
|
85
|
+
if (initialIndentLevel > 0) {
|
|
86
|
+
var indent = options.insertSpaces ? (0, strings_1.repeat)(' ', tabSize * initialIndentLevel) : (0, strings_1.repeat)('\t', initialIndentLevel);
|
|
87
|
+
result = result.split('\n').join('\n' + indent);
|
|
88
|
+
if (range.start.character === 0) {
|
|
89
|
+
result = indent + result; // keep the indent
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return [{
|
|
93
|
+
range: range,
|
|
94
|
+
newText: result
|
|
95
|
+
}];
|
|
96
|
+
}
|
|
97
|
+
exports.format = format;
|
|
98
|
+
function trimLeft(str) {
|
|
99
|
+
return str.replace(/^\s+/, '');
|
|
100
|
+
}
|
|
101
|
+
var _CUL = '{'.charCodeAt(0);
|
|
102
|
+
var _CUR = '}'.charCodeAt(0);
|
|
103
|
+
function isInRule(str, offset) {
|
|
104
|
+
while (offset >= 0) {
|
|
105
|
+
var ch = str.charCodeAt(offset);
|
|
106
|
+
if (ch === _CUL) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
else if (ch === _CUR) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
offset--;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
function getFormatOption(options, key, dflt) {
|
|
117
|
+
if (options && options.hasOwnProperty(key)) {
|
|
118
|
+
var value = options[key];
|
|
119
|
+
if (value !== null) {
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return dflt;
|
|
124
|
+
}
|
|
125
|
+
function computeIndentLevel(content, offset, options) {
|
|
126
|
+
var i = offset;
|
|
127
|
+
var nChars = 0;
|
|
128
|
+
var tabSize = options.tabSize || 4;
|
|
129
|
+
while (i < content.length) {
|
|
130
|
+
var ch = content.charAt(i);
|
|
131
|
+
if (ch === ' ') {
|
|
132
|
+
nChars++;
|
|
133
|
+
}
|
|
134
|
+
else if (ch === '\t') {
|
|
135
|
+
nChars += tabSize;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
i++;
|
|
141
|
+
}
|
|
142
|
+
return Math.floor(nChars / tabSize);
|
|
143
|
+
}
|
|
144
|
+
function isEOL(text, offset) {
|
|
145
|
+
return '\r\n'.indexOf(text.charAt(offset)) !== -1;
|
|
146
|
+
}
|
|
147
|
+
function isWhitespace(text, offset) {
|
|
148
|
+
return ' \t'.indexOf(text.charAt(offset)) !== -1;
|
|
149
|
+
}
|
|
150
|
+
});
|
package/lib/umd/utils/strings.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*--------------------------------------------------------------------------------------------*/
|
|
14
14
|
'use strict';
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.trim = exports.getLimitedString = exports.difference = exports.endsWith = exports.startsWith = void 0;
|
|
16
|
+
exports.repeat = exports.trim = exports.getLimitedString = exports.difference = exports.endsWith = exports.startsWith = void 0;
|
|
17
17
|
function startsWith(haystack, needle) {
|
|
18
18
|
if (haystack.length < needle.length) {
|
|
19
19
|
return false;
|
|
@@ -107,4 +107,16 @@
|
|
|
107
107
|
return str;
|
|
108
108
|
}
|
|
109
109
|
exports.trim = trim;
|
|
110
|
+
function repeat(value, count) {
|
|
111
|
+
var s = '';
|
|
112
|
+
while (count > 0) {
|
|
113
|
+
if ((count & 1) === 1) {
|
|
114
|
+
s += value;
|
|
115
|
+
}
|
|
116
|
+
value += value;
|
|
117
|
+
count = count >>> 1;
|
|
118
|
+
}
|
|
119
|
+
return s;
|
|
120
|
+
}
|
|
121
|
+
exports.repeat = repeat;
|
|
110
122
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-css-languageservice",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.4.1",
|
|
4
4
|
"description": "Language service for CSS, LESS and SCSS",
|
|
5
5
|
"main": "./lib/umd/cssLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/cssLanguageService",
|
|
@@ -17,34 +17,38 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/mocha": "^9.1.0",
|
|
19
19
|
"@types/node": "^10.12.21",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
21
|
-
"@typescript-eslint/parser": "^5.
|
|
22
|
-
"@vscode/web-custom-data": "^0.3.
|
|
23
|
-
"eslint": "^8.
|
|
24
|
-
"
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
21
|
+
"@typescript-eslint/parser": "^5.17.0",
|
|
22
|
+
"@vscode/web-custom-data": "^0.3.9",
|
|
23
|
+
"eslint": "^8.11.0",
|
|
24
|
+
"js-beautify": "^1.14.2",
|
|
25
|
+
"mocha": "^9.2.2",
|
|
25
26
|
"rimraf": "^3.0.2",
|
|
26
27
|
"typescript": "^4.5.5"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
30
|
+
"vscode-languageserver-textdocument": "^1.0.4",
|
|
30
31
|
"vscode-languageserver-types": "^3.16.0",
|
|
31
32
|
"vscode-nls": "^5.0.0",
|
|
32
|
-
"vscode-uri": "^3.0.
|
|
33
|
+
"vscode-uri": "^3.0.3"
|
|
33
34
|
},
|
|
34
35
|
"scripts": {
|
|
35
36
|
"prepublishOnly": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
|
|
36
37
|
"postpublish": "node ./build/post-publish.js",
|
|
37
|
-
"compile": "tsc -p ./src && npm run lint",
|
|
38
|
+
"compile": "tsc -p ./src && npm run copy-jsbeautify && npm run lint ",
|
|
38
39
|
"compile-esm": "tsc -p ./src/tsconfig.esm.json",
|
|
39
40
|
"clean": "rimraf lib",
|
|
40
41
|
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js",
|
|
41
|
-
"watch": "tsc -w -p ./src",
|
|
42
|
+
"watch": "npm run copy-jsbeautify && tsc -w -p ./src",
|
|
42
43
|
"test": "npm run compile && mocha",
|
|
43
44
|
"mocha": "mocha",
|
|
44
45
|
"coverage": "npm run compile && npx nyc --reporter=html --reporter=text mocha",
|
|
45
46
|
"lint": "eslint src/**/*.ts",
|
|
46
47
|
"update-data": "yarn add @vscode/web-custom-data -D && node ./build/generateData.js",
|
|
47
48
|
"install-types-next": "yarn add vscode-languageserver-types@next -f -S && yarn add vscode-languageserver-textdocument@next -f -S",
|
|
49
|
+
"copy-jsbeautify": "node ./build/copy-jsbeautify.js",
|
|
50
|
+
"update-jsbeautify": "yarn add js-beautify && node ./build/update-jsbeautify.js",
|
|
51
|
+
"update-jsbeautify-next": "yarn add js-beautify@next && node ./build/update-jsbeautify.js",
|
|
48
52
|
"preversion": "npm test",
|
|
49
53
|
"postversion": "git push && git push --tags"
|
|
50
54
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
|
2
|
+
|
|
3
|
+
vscode-css-languageservice incorporates third party material from the projects listed below. The original copyright
|
|
4
|
+
notice and the license under which Microsoft received such third party material are set forth below. Microsoft
|
|
5
|
+
reserves all other rights not expressly granted, whether by implication, estoppel or otherwise.
|
|
6
|
+
|
|
7
|
+
1. JS Beautifier (https://github.com/beautify-web/js-beautify)
|
|
8
|
+
|
|
9
|
+
The MIT License (MIT)
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
|
21
|
+
all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
29
|
+
THE SOFTWARE.
|