Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscode-css-languageservice

Package Overview
Dependencies
Maintainers
4
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-css-languageservice - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

lib/parser/lessParser.js

@@ -215,3 +215,3 @@ var __extends = (this && this.__extends) || (function () {

if (this.accept(cssScanner_1.TokenType.Delim, '&')) {
while (!this.hasWhitespace() && (this.accept(cssScanner_1.TokenType.Delim, '-') || node.addChild(this._parseIdent()) || this.accept(cssScanner_1.TokenType.Delim, '&'))) {
while (!this.hasWhitespace() && (this.accept(cssScanner_1.TokenType.Delim, '-') || this.accept(cssScanner_1.TokenType.Num) || node.addChild(this._parseIdent()) || this.accept(cssScanner_1.TokenType.Delim, '&'))) {
// support &-foo

@@ -218,0 +218,0 @@ }

@@ -235,4 +235,4 @@ var __extends = (this && this.__extends) || (function () {

if (this.accept(cssScanner_1.TokenType.Delim, '&')) {
while (!this.hasWhitespace() && (this.accept(cssScanner_1.TokenType.Delim, '-') || node.addChild(this._parseIdent()) || this.accept(cssScanner_1.TokenType.Delim, '&'))) {
// support &-foo
while (!this.hasWhitespace() && (this.accept(cssScanner_1.TokenType.Delim, '-') || this.accept(cssScanner_1.TokenType.Num) || node.addChild(this._parseIdent()) || this.accept(cssScanner_1.TokenType.Delim, '&'))) {
// support &-foo-1
}

@@ -239,0 +239,0 @@ return this.finish(node);

@@ -59,3 +59,3 @@ (function (factory) {

var parentRuleSet = node.findParent(nodes.NodeType.Ruleset);
this.getCompletionsForSelector(parentRuleSet, result);
this.getCompletionsForSelector(parentRuleSet, parentRuleSet.isNested(), result);
}

@@ -87,17 +87,12 @@ else if (node instanceof nodes.FunctionArgument) {

if (result.items.length > 0) {
return result;
return this.finalize(result);
}
}
this.getCompletionsForStylesheet(result);
if (result.items.length > 0) {
return result;
}
if (this.variablePrefix && this.currentWord.indexOf(this.variablePrefix) === 0) {
this.getVariableProposals(null, result);
if (result.items.length > 0) {
return result;
if (result.items.length === 0) {
if (this.variablePrefix && this.currentWord.indexOf(this.variablePrefix) === 0) {
this.getVariableProposals(null, result);
}
}
// no match, don't show text matches
return result;
return this.finalize(result);
}

@@ -115,2 +110,13 @@ finally {

};
CSSCompletion.prototype.finalize = function (result) {
var needsSortText = result.items.some(function (i) { return !!i.sortText; });
if (needsSortText) {
result.items.forEach(function (i) {
if (!i.sortText) {
i.sortText = 'd';
}
});
}
return result;
};
CSSCompletion.prototype.findInNodePath = function () {

@@ -148,3 +154,3 @@ var types = [];

}
result.items.push({
var item = {
label: entry.name,

@@ -154,3 +160,7 @@ documentation: languageFacts.getEntryDescription(entry),

kind: vscode_languageserver_types_1.CompletionItemKind.Property
});
};
if (strings.startsWith(entry.name, '-')) {
item.sortText = 'x';
}
result.items.push(item);
}

@@ -170,10 +180,37 @@ }

if (entry) {
this.getColorProposals(entry, existingNode, result);
this.getPositionProposals(entry, existingNode, result);
this.getRepeatStyleProposals(entry, existingNode, result);
this.getLineProposals(entry, existingNode, result);
this.getBoxProposals(entry, existingNode, result);
this.getImageProposals(entry, existingNode, result);
this.getTimingFunctionProposals(entry, existingNode, result);
this.getBasicShapeProposals(entry, existingNode, result);
for (var _i = 0, _a = entry.restrictions; _i < _a.length; _i++) {
var restriction = _a[_i];
switch (restriction) {
case 'color':
this.getColorProposals(entry, existingNode, result);
break;
case 'position':
this.getColorProposals(entry, existingNode, result);
break;
case 'repeat':
this.getRepeatStyleProposals(entry, existingNode, result);
break;
case 'line-style':
this.getLineStyleProposals(entry, existingNode, result);
break;
case 'line-width':
this.getLineWidthProposals(entry, existingNode, result);
break;
case 'geometry-box':
this.getGeometryBoxProposals(entry, existingNode, result);
break;
case 'box':
this.getBoxProposals(entry, existingNode, result);
break;
case 'image':
this.getImageProposals(entry, existingNode, result);
break;
case 'timing-function':
this.getTimingFunctionProposals(entry, existingNode, result);
break;
case 'shape':
this.getBasicShapeProposals(entry, existingNode, result);
break;
}
}
this.getValueEnumProposals(entry, existingNode, result);

@@ -195,3 +232,3 @@ this.getCSSWideKeywordProposals(entry, existingNode, result);

this.getVariableProposals(existingNode, result);
this.getTermProposals(existingNode, result);
this.getTermProposals(entry, existingNode, result);
return result;

@@ -204,8 +241,22 @@ };

if (languageFacts.isCommonValue(value)) {
result.items.push({
var insertString = value.name;
var insertTextFormat = void 0;
if (strings.endsWith(insertString, ')')) {
var from = insertString.lastIndexOf('(');
if (from !== -1) {
insertString = insertString.substr(0, from) + '($1)';
insertTextFormat = SnippetFormat;
}
}
var item = {
label: value.name,
documentation: languageFacts.getEntryDescription(value),
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), value.name),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), insertString),
kind: vscode_languageserver_types_1.CompletionItemKind.Value,
insertTextFormat: insertTextFormat
};
if (insertTextFormat) {
item.insertTextFormat = insertTextFormat;
}
result.items.push(item);
}

@@ -242,3 +293,4 @@ });

textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), insertText),
kind: vscode_languageserver_types_1.CompletionItemKind.Variable
kind: vscode_languageserver_types_1.CompletionItemKind.Variable,
sortText: 'z'
};

@@ -284,2 +336,5 @@ if (symbol.node.type === nodes.NodeType.FunctionParameter) {

}
if (existingNode && existingNode.parent && existingNode.parent.type === nodes.NodeType.Term) {
existingNode = existingNode.getParent(); // include the unary operator
}
entry.restrictions.forEach(function (restriction) {

@@ -309,54 +364,50 @@ var units = languageFacts.units[restriction];

var _this = this;
if (entry.restrictions.indexOf('color') !== -1) {
for (var color in languageFacts.colors) {
result.items.push({
label: color,
documentation: languageFacts.colors[color],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), color),
kind: vscode_languageserver_types_1.CompletionItemKind.Color
});
}
for (var color in languageFacts.colorKeywords) {
result.items.push({
label: color,
documentation: languageFacts.colorKeywords[color],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), color),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
var colorValues = new Set();
this.styleSheet.accept(new ColorValueCollector(colorValues));
colorValues.getEntries().forEach(function (color) {
result.items.push({
label: color,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), color),
kind: vscode_languageserver_types_1.CompletionItemKind.Color
});
for (var color in languageFacts.colors) {
result.items.push({
label: color,
documentation: languageFacts.colors[color],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), color),
kind: vscode_languageserver_types_1.CompletionItemKind.Color
});
languageFacts.colorFunctions.forEach(function (p) {
var tabStop = 1;
var replaceFunction = function (match, p1) { return '${' + tabStop++ + ':' + p1 + '}'; };
var insertText = p.func.replace(/\[?\$(\w+)\]?/g, replaceFunction);
result.items.push({
label: p.func.substr(0, p.func.indexOf('(')),
detail: p.func,
documentation: p.desc,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), insertText),
insertTextFormat: SnippetFormat,
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
}
for (var color in languageFacts.colorKeywords) {
result.items.push({
label: color,
documentation: languageFacts.colorKeywords[color],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), color),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
var colorValues = new Set();
this.styleSheet.accept(new ColorValueCollector(colorValues));
colorValues.getEntries().forEach(function (color) {
result.items.push({
label: color,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), color),
kind: vscode_languageserver_types_1.CompletionItemKind.Color
});
});
languageFacts.colorFunctions.forEach(function (p) {
var tabStop = 1;
var replaceFunction = function (match, p1) { return '${' + tabStop++ + ':' + p1 + '}'; };
var insertText = p.func.replace(/\[?\$(\w+)\]?/g, replaceFunction);
result.items.push({
label: p.func.substr(0, p.func.indexOf('(')),
detail: p.func,
documentation: p.desc,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), insertText),
insertTextFormat: SnippetFormat,
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
});
return result;
};
CSSCompletion.prototype.getPositionProposals = function (entry, existingNode, result) {
if (entry.restrictions.indexOf('position') !== -1) {
for (var position in languageFacts.positionKeywords) {
result.items.push({
label: position,
documentation: languageFacts.positionKeywords[position],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), position),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
for (var position in languageFacts.positionKeywords) {
result.items.push({
label: position,
documentation: languageFacts.positionKeywords[position],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), position),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}

@@ -366,34 +417,42 @@ return result;

CSSCompletion.prototype.getRepeatStyleProposals = function (entry, existingNode, result) {
if (entry.restrictions.indexOf('repeat') !== -1) {
for (var repeat in languageFacts.repeatStyleKeywords) {
result.items.push({
label: repeat,
documentation: languageFacts.repeatStyleKeywords[repeat],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), repeat),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
for (var repeat in languageFacts.repeatStyleKeywords) {
result.items.push({
label: repeat,
documentation: languageFacts.repeatStyleKeywords[repeat],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), repeat),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getLineProposals = function (entry, existingNode, result) {
CSSCompletion.prototype.getLineStyleProposals = function (entry, existingNode, result) {
for (var lineStyle in languageFacts.lineStyleKeywords) {
result.items.push({
label: lineStyle,
documentation: languageFacts.lineStyleKeywords[lineStyle],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), lineStyle),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getLineWidthProposals = function (entry, existingNode, result) {
var _this = this;
if (entry.restrictions.indexOf('line-style') !== -1) {
for (var lineStyle in languageFacts.lineStyleKeywords) {
result.items.push({
label: lineStyle,
documentation: languageFacts.lineStyleKeywords[lineStyle],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), lineStyle),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
}
if (entry.restrictions.indexOf('line-width') !== -1) {
languageFacts.lineWidthKeywords.forEach(function (lineWidth) {
result.items.push({
label: lineWidth,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), lineWidth),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
languageFacts.lineWidthKeywords.forEach(function (lineWidth) {
result.items.push({
label: lineWidth,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), lineWidth),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
});
return result;
};
CSSCompletion.prototype.getGeometryBoxProposals = function (entry, existingNode, result) {
for (var box in languageFacts.geometryBoxKeywords) {
result.items.push({
label: box,
documentation: languageFacts.geometryBoxKeywords[box],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), box),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}

@@ -403,35 +462,20 @@ return result;

CSSCompletion.prototype.getBoxProposals = function (entry, existingNode, result) {
var geometryBox = entry.restrictions.indexOf('geometry-box');
if (geometryBox !== -1) {
for (var box in languageFacts.geometryBoxKeywords) {
result.items.push({
label: box,
documentation: languageFacts.geometryBoxKeywords[box],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), box),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
for (var box in languageFacts.boxKeywords) {
result.items.push({
label: box,
documentation: languageFacts.boxKeywords[box],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), box),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
if (entry.restrictions.indexOf('box') !== -1 || geometryBox !== -1) {
for (var box in languageFacts.boxKeywords) {
result.items.push({
label: box,
documentation: languageFacts.boxKeywords[box],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), box),
kind: vscode_languageserver_types_1.CompletionItemKind.Value
});
}
}
return result;
};
CSSCompletion.prototype.getImageProposals = function (entry, existingNode, result) {
if (entry.restrictions.indexOf('image') !== -1) {
for (var image in languageFacts.imageFunctions) {
result.items.push({
label: image,
documentation: languageFacts.imageFunctions[image],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), image),
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
}
for (var image in languageFacts.imageFunctions) {
result.items.push({
label: image,
documentation: languageFacts.imageFunctions[image],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), image),
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
}

@@ -441,11 +485,9 @@ return result;

CSSCompletion.prototype.getTimingFunctionProposals = function (entry, existingNode, result) {
if (entry.restrictions.indexOf('timing-function') !== -1) {
for (var timing in languageFacts.transitionTimingFunctions) {
result.items.push({
label: timing,
documentation: languageFacts.transitionTimingFunctions[timing],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), timing),
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
}
for (var timing in languageFacts.transitionTimingFunctions) {
result.items.push({
label: timing,
documentation: languageFacts.transitionTimingFunctions[timing],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), timing),
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
}

@@ -455,11 +497,9 @@ return result;

CSSCompletion.prototype.getBasicShapeProposals = function (entry, existingNode, result) {
if (entry.restrictions.indexOf('shape') !== -1) {
for (var shape in languageFacts.basicShapeFunctions) {
result.items.push({
label: shape,
documentation: languageFacts.basicShapeFunctions[shape],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), shape),
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
}
for (var shape in languageFacts.basicShapeFunctions) {
result.items.push({
label: shape,
documentation: languageFacts.basicShapeFunctions[shape],
textEdit: vscode_languageserver_types_1.TextEdit.replace(this.getCompletionRange(existingNode), shape),
kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
}

@@ -490,3 +530,3 @@ return result;

});
this.getCompletionsForSelector(null, result);
this.getCompletionsForSelector(null, false, result);
return result;

@@ -506,3 +546,3 @@ };

}
return this.getCompletionsForSelector(ruleSet, result);
return this.getCompletionsForSelector(ruleSet, ruleSet.isNested(), result);
}

@@ -512,3 +552,3 @@ ruleSet.findParent(nodes.NodeType.Ruleset);

};
CSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, result) {
CSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, isNested, result) {
var _this = this;

@@ -523,3 +563,3 @@ var existingNode = this.findInNodePath(nodes.NodeType.PseudoSelector, nodes.NodeType.IdentifierSelector, nodes.NodeType.ClassSelector, nodes.NodeType.ElementNameSelector);

if (entry.browsers.onCodeComplete) {
result.items.push({
var item = {
label: entry.name,

@@ -529,3 +569,7 @@ textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), entry.name),

kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
};
if (strings.startsWith(entry.name, ':-')) {
item.sortText = 'x';
}
result.items.push(item);
}

@@ -535,3 +579,3 @@ });

if (entry.browsers.onCodeComplete) {
result.items.push({
var item = {
label: entry.name,

@@ -541,19 +585,25 @@ textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), entry.name),

kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
};
if (strings.startsWith(entry.name, '::-')) {
item.sortText = 'x';
}
result.items.push(item);
}
});
languageFacts.html5Tags.forEach(function (entry) {
result.items.push({
label: entry,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), entry),
kind: vscode_languageserver_types_1.CompletionItemKind.Keyword
if (!isNested) {
languageFacts.html5Tags.forEach(function (entry) {
result.items.push({
label: entry,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), entry),
kind: vscode_languageserver_types_1.CompletionItemKind.Keyword
});
});
});
languageFacts.svgElements.forEach(function (entry) {
result.items.push({
label: entry,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), entry),
kind: vscode_languageserver_types_1.CompletionItemKind.Keyword
languageFacts.svgElements.forEach(function (entry) {
result.items.push({
label: entry,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), entry),
kind: vscode_languageserver_types_1.CompletionItemKind.Keyword
});
});
});
}
var visited = {};

@@ -586,3 +636,3 @@ visited[this.currentWord] = true;

CSSCompletion.prototype.getCompletionsForDeclarations = function (declarations, result) {
if (!declarations) {
if (!declarations || this.offset === declarations.offset) {
return result;

@@ -627,3 +677,3 @@ }

if (!declaration) {
this.getTermProposals(null, result);
this.getTermProposals(null, null, result);
return result;

@@ -651,3 +701,3 @@ }

if (declarations && this.offset > declarations.offset && this.offset < declarations.end) {
this.getTermProposals(null, result);
this.getTermProposals(null, null, result);
}

@@ -666,3 +716,3 @@ return result;

};
CSSCompletion.prototype.getTermProposals = function (existingNode, result) {
CSSCompletion.prototype.getTermProposals = function (entry, existingNode, result) {
var _this = this;

@@ -688,3 +738,4 @@ var allFunctions = this.getSymbolContext().findSymbolsAtOffset(this.offset, nodes.ReferenceType.Function);

insertTextFormat: SnippetFormat,
kind: vscode_languageserver_types_1.CompletionItemKind.Function
kind: vscode_languageserver_types_1.CompletionItemKind.Function,
sortText: 'z'
};

@@ -691,0 +742,0 @@ };

@@ -35,6 +35,6 @@ var __extends = (this && this.__extends) || (function () {

}
LESSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, result) {
LESSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, sortToEnd, result) {
var _this = this;
proposals.forEach(function (p) {
result.items.push({
var item = {
label: p.name,

@@ -46,12 +46,20 @@ detail: p.example,

kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
};
if (sortToEnd) {
item.sortText = 'z';
}
result.items.push(item);
});
return result;
};
LESSCompletion.prototype.getTermProposals = function (existingNode, result) {
this.createFunctionProposals(LESSCompletion.builtInProposals, existingNode, result);
return _super.prototype.getTermProposals.call(this, existingNode, result);
LESSCompletion.prototype.getTermProposals = function (entry, existingNode, result) {
var functions = LESSCompletion.builtInProposals;
if (entry) {
functions = functions.filter(function (f) { return !f.type || entry.restrictions.indexOf(f.type) !== -1; });
}
this.createFunctionProposals(functions, existingNode, true, result);
return _super.prototype.getTermProposals.call(this, entry, existingNode, result);
};
LESSCompletion.prototype.getColorProposals = function (entry, existingNode, result) {
this.createFunctionProposals(LESSCompletion.colorProposals, existingNode, result);
this.createFunctionProposals(LESSCompletion.colorProposals, existingNode, false, result);
return _super.prototype.getColorProposals.call(this, entry, existingNode, result);

@@ -85,3 +93,4 @@ };

'example': 'color(@string);',
'description': localize('less.builtin.color', 'parses a string to a color')
'description': localize('less.builtin.color', 'parses a string to a color'),
'type': 'color'
},

@@ -96,3 +105,4 @@ {

'example': 'data-uri([mimetype,] url);',
'description': localize('less.builtin.data-uri', 'inlines a resource and falls back to `url()`')
'description': localize('less.builtin.data-uri', 'inlines a resource and falls back to `url()`'),
'type': 'url'
},

@@ -142,3 +152,4 @@ {

'description': localize('less.builtin.percentage', 'converts to a %, e.g. 0.5 > 50%'),
'example': 'percentage(@number);'
'example': 'percentage(@number);',
'type': 'percentage'
},

@@ -325,3 +336,3 @@ {

'example': 'greyscale(@color);',
'description': localize('less.builtin.greyscale', 'returns a grey, 100% desaturated color')
'description': localize('less.builtin.greyscale', 'returns a grey, 100% desaturated color'),
},

@@ -328,0 +339,0 @@ {

@@ -299,3 +299,8 @@ (function (factory) {

for (var index = 0; index < elem.length; index++) {
self.addEntry(elem[index].node, lintRules_1.Rules.PropertyIgnoredDueToDisplay, localize('rule.propertyIgnoredDueToDisplayInline', "Property is ignored due to the display. With 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect."));
var node_1 = elem[index].node;
var value = node_1.getValue();
if (prop === 'float' && (!value || value.matches('none'))) {
continue;
}
self.addEntry(node_1, lintRules_1.Rules.PropertyIgnoredDueToDisplay, localize('rule.propertyIgnoredDueToDisplayInline', "Property is ignored due to the display. With 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect."));
}

@@ -309,3 +314,7 @@ });

for (var index = 0; index < elem.length; index++) {
this.addEntry(elem[index].node, lintRules_1.Rules.PropertyIgnoredDueToDisplay, localize('rule.propertyIgnoredDueToDisplayInlineBlock', "Property is ignored due to the display. With 'display: inline-block', float properties have no effect."));
var node_2 = elem[index].node;
var value = node_2.getValue();
if (value && !value.matches('none')) {
this.addEntry(node_2, lintRules_1.Rules.PropertyIgnoredDueToDisplay, localize('rule.propertyIgnoredDueToDisplayInlineBlock', "Property is ignored due to the display. With 'display: inline-block', float properties have no effect."));
}
}

@@ -433,3 +442,3 @@ }

var value = node.getValue();
if (value.unit === '%') {
if (!value.unit || languageFacts.units.length.indexOf(value.unit.toLowerCase()) === -1) {
return true;

@@ -436,0 +445,0 @@ }

@@ -41,8 +41,9 @@ var __extends = (this && this.__extends) || (function () {

};
SCSSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, result) {
SCSSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, sortToEnd, result) {
var _this = this;
proposals.forEach(function (p) {
var insertText = p.func.replace(/\[?(\$\w+)\]?/g, _this.createReplaceFunction());
result.items.push({
label: p.func.substr(0, p.func.indexOf('(')),
var label = p.func.substr(0, p.func.indexOf('('));
var item = {
label: label,
detail: p.func,

@@ -53,20 +54,28 @@ documentation: p.desc,

kind: vscode_languageserver_types_1.CompletionItemKind.Function
});
};
if (sortToEnd) {
item.sortText = 'z';
}
result.items.push(item);
});
return result;
};
SCSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, result) {
this.createFunctionProposals(SCSSCompletion.selectorFuncs, void 0, result);
return _super.prototype.getCompletionsForSelector.call(this, ruleSet, result);
SCSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, isNested, result) {
this.createFunctionProposals(SCSSCompletion.selectorFuncs, void 0, true, result);
return _super.prototype.getCompletionsForSelector.call(this, ruleSet, isNested, result);
};
SCSSCompletion.prototype.getTermProposals = function (existingNode, result) {
this.createFunctionProposals(SCSSCompletion.builtInFuncs, existingNode, result);
return _super.prototype.getTermProposals.call(this, existingNode, result);
SCSSCompletion.prototype.getTermProposals = function (entry, existingNode, result) {
var functions = SCSSCompletion.builtInFuncs;
if (entry) {
functions = functions.filter(function (f) { return !f.type || entry.restrictions.indexOf(f.type) !== -1; });
}
this.createFunctionProposals(functions, existingNode, true, result);
return _super.prototype.getTermProposals.call(this, entry, existingNode, result);
};
SCSSCompletion.prototype.getColorProposals = function (entry, existingNode, result) {
this.createFunctionProposals(SCSSCompletion.colorProposals, existingNode, result);
this.createFunctionProposals(SCSSCompletion.colorProposals, existingNode, false, result);
return _super.prototype.getColorProposals.call(this, entry, existingNode, result);
};
SCSSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) {
this.getCompletionsForSelector(null, result);
this.getCompletionsForSelector(null, true, result);
return _super.prototype.getCompletionsForDeclarationProperty.call(this, declaration, result);

@@ -139,3 +148,3 @@ };

{ func: 'to-lower-case($string)', desc: localize('scss.builtin.to-lower-case', 'Converts a string to lower case.') },
{ func: 'percentage($number)', desc: localize('scss.builtin.percentage', 'Converts a unitless number to a percentage.') },
{ func: 'percentage($number)', desc: localize('scss.builtin.percentage', 'Converts a unitless number to a percentage.'), type: 'percentage' },
{ func: 'round($number)', desc: localize('scss.builtin.round', 'Rounds a number to the nearest whole number.') },

@@ -142,0 +151,0 @@ { func: 'ceil($number)', desc: localize('scss.builtin.ceil', 'Rounds a number up to the next whole number.') },

{
"name": "vscode-css-languageservice",
"version": "2.0.1",
"version": "2.0.2",
"description": "Language service for CSS, LESS and SCSS",

@@ -5,0 +5,0 @@ "main": "./lib/cssLanguageService.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc