vscode-css-languageservice
Advanced tools
Comparing version 3.0.9-next.15 to 3.0.9-next.16
@@ -1206,8 +1206,2 @@ /*--------------------------------------------------------------------------------------------- | ||
}); | ||
AttributeSelector.prototype.setExpression = function (value) { | ||
return this.setNode('expression', value); | ||
}; | ||
AttributeSelector.prototype.getExpression = function () { | ||
return this.expression; | ||
}; | ||
AttributeSelector.prototype.setNamespacePrefix = function (value) { | ||
@@ -1219,2 +1213,20 @@ return this.setNode('namespacePrefix', value); | ||
}; | ||
AttributeSelector.prototype.setIdentifier = function (value) { | ||
return this.setNode('identifier', value); | ||
}; | ||
AttributeSelector.prototype.getIdentifier = function () { | ||
return this.identifier; | ||
}; | ||
AttributeSelector.prototype.setOperator = function (operator) { | ||
return this.setNode('operator', operator); | ||
}; | ||
AttributeSelector.prototype.getOperator = function () { | ||
return this.operator; | ||
}; | ||
AttributeSelector.prototype.setValue = function (value) { | ||
return this.setNode('value', value); | ||
}; | ||
AttributeSelector.prototype.getValue = function () { | ||
return this.value; | ||
}; | ||
return AttributeSelector; | ||
@@ -1221,0 +1233,0 @@ }(Node)); |
@@ -12,2 +12,3 @@ /*--------------------------------------------------------------------------------------------- | ||
/// A parser for the css core specification. See for reference: | ||
/// https://www.w3.org/TR/CSS21/grammar.html | ||
/// http://www.w3.org/TR/CSS21/syndata.html#tokenization | ||
@@ -1021,5 +1022,9 @@ /// </summary> | ||
node.setNamespacePrefix(this._parseNamespacePrefix()); | ||
if (!node.setExpression(this._parseBinaryExpr())) { | ||
// is this bad? | ||
if (!node.setIdentifier(this._parseIdent())) { | ||
return this.finish(node, ParseError.IdentifierExpected); | ||
} | ||
if (node.setOperator(this._parseOperator())) { | ||
node.setValue(this._parseBinaryExpr()); | ||
this.acceptIdent('i'); // case insensitive matching | ||
} | ||
if (!this.accept(TokenType.BracketR)) { | ||
@@ -1099,3 +1104,3 @@ return this.finish(node, ParseError.RightSquareBracketExpected); | ||
var node = this.create(nodes.Expression); | ||
if (!node.addChild(this._parseNamedLine() || this._parseBinaryExpr())) { | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
return null; | ||
@@ -1110,3 +1115,3 @@ } | ||
} | ||
if (!node.addChild(this._parseNamedLine() || this._parseBinaryExpr())) { | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
break; | ||
@@ -1160,3 +1165,4 @@ } | ||
node.setExpression(this._parseHexColor()) || | ||
node.setExpression(this._parseOperation())) { | ||
node.setExpression(this._parseOperation()) || | ||
node.setExpression(this._parseNamedLine())) { | ||
return this.finish(node); | ||
@@ -1163,0 +1169,0 @@ } |
@@ -186,2 +186,3 @@ /*--------------------------------------------------------------------------------------------- | ||
staticUnitTable['%'] = TokenType.Percentage; | ||
staticUnitTable['fr'] = TokenType.Percentage; | ||
staticUnitTable['dpi'] = TokenType.Resolution; | ||
@@ -188,0 +189,0 @@ staticUnitTable['dpcm'] = TokenType.Resolution; |
@@ -134,3 +134,3 @@ /*--------------------------------------------------------------------------------------------- | ||
LESSParser.prototype._parseDetachedRuleSetBody = function () { | ||
return this._tryParseKeyframeSelector() || _super.prototype._parseRuleSetDeclaration.call(this); | ||
return this._tryParseKeyframeSelector() || this._tryParseRuleset(true) || _super.prototype._parseRuleSetDeclaration.call(this); | ||
}; | ||
@@ -137,0 +137,0 @@ LESSParser.prototype._parseVariable = function () { |
@@ -97,3 +97,6 @@ /*--------------------------------------------------------------------------------------------- | ||
SCSSParser.prototype._parseKeyframeSelector = function () { | ||
return this._tryParseKeyframeSelector() || this._parseControlStatement(this._parseKeyframeSelector.bind(this)) || this._parseMixinContent(); | ||
return this._tryParseKeyframeSelector() | ||
|| this._parseControlStatement(this._parseKeyframeSelector.bind(this)) | ||
|| this._parseVariableDeclaration() | ||
|| this._parseMixinContent(); | ||
}; | ||
@@ -100,0 +103,0 @@ SCSSParser.prototype._parseVariable = function () { |
@@ -101,2 +101,5 @@ /*--------------------------------------------------------------------------------------------- | ||
this.getCompletionForUriLiteralValue(node, result); | ||
} | ||
else if (node.parent === null) { | ||
this.getCompletionForTopLevel(result); | ||
// } else if (node instanceof nodes.Variable) { | ||
@@ -103,0 +106,0 @@ // this.getCompletionsForVariableDeclaration() |
@@ -285,3 +285,3 @@ /*--------------------------------------------------------------------------------------------- | ||
'resolution': ['dpi', 'dpcm', 'dppx'], | ||
'percentage': ['%'] | ||
'percentage': ['%', 'fr'] | ||
}; | ||
@@ -585,9 +585,21 @@ export var html5Tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', | ||
} | ||
export function expandEntryStatus(status) { | ||
switch (status) { | ||
case 'e': | ||
return 'experimental'; | ||
case 'n': | ||
return 'nonstandard'; | ||
case 'o': | ||
return 'obsolete'; | ||
default: | ||
return 'standard'; | ||
} | ||
} | ||
function getEntryStatus(status) { | ||
switch (status) { | ||
case 'experimental': | ||
case 'e': | ||
return '⚠️ Property is experimental. Be cautious when using it.️\n\n'; | ||
case 'nonstandard': | ||
case 'n': | ||
return '🚨️ Property is nonstandard. Avoid using it.\n\n'; | ||
case 'obsolete': | ||
case 'o': | ||
return '🚨️️️ Property is obsolete. Avoid using it.\n\n'; | ||
@@ -718,3 +730,3 @@ default: | ||
get: function () { | ||
return this.data.status || 'standard'; | ||
return expandEntryStatus(this.data.status); | ||
}, | ||
@@ -758,3 +770,3 @@ enumerable: true, | ||
atDirectiveList = []; | ||
for (var i = 0, len = atDirectives.length; i < len; i++) { | ||
for (var i = 0; i < atDirectives.length; i++) { | ||
var rawEntry = atDirectives[i]; | ||
@@ -771,3 +783,3 @@ atDirectiveList.push(new EntryImpl(rawEntry)); | ||
pseudoElementList = []; | ||
for (var i = 0, len = pseudoElements.length; i < len; i++) { | ||
for (var i = 0; i < pseudoElements.length; i++) { | ||
var rawEntry = pseudoElements[i]; | ||
@@ -784,3 +796,3 @@ pseudoElementList.push(new EntryImpl(rawEntry)); | ||
pseudoClassesList = []; | ||
for (var i = 0, len = pseudoClasses.length; i < len; i++) { | ||
for (var i = 0; i < pseudoClasses.length; i++) { | ||
var rawEntry = pseudoClasses[i]; | ||
@@ -787,0 +799,0 @@ pseudoClassesList.push(new EntryImpl(rawEntry)); |
@@ -414,9 +414,15 @@ /*--------------------------------------------------------------------------------------------- | ||
///////////////////////////////////////////////////////////// | ||
var value = node.getValue(); | ||
if (!value.unit || languageFacts.units.length.indexOf(value.unit.toLowerCase()) === -1) { | ||
return true; | ||
var decl = node.findParent(nodes.NodeType.Declaration); | ||
if (decl) { | ||
var declValue = decl.getValue(); | ||
if (declValue && declValue.offset === node.offset && declValue.length === node.length) { | ||
var value = node.getValue(); | ||
if (!value.unit || languageFacts.units.length.indexOf(value.unit.toLowerCase()) === -1) { | ||
return true; | ||
} | ||
if (parseFloat(value.value) === 0.0 && !!value.unit) { | ||
this.addEntry(node, Rules.ZeroWithUnit); | ||
} | ||
} | ||
} | ||
if (parseFloat(value.value) === 0.0 && !!value.unit) { | ||
this.addEntry(node, Rules.ZeroWithUnit); | ||
} | ||
return true; | ||
@@ -423,0 +429,0 @@ }; |
@@ -69,2 +69,3 @@ /*--------------------------------------------------------------------------------------------- | ||
SCSSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) { | ||
this.getCompletionForAtDirectives(result); | ||
this.getCompletionsForSelector(null, true, result); | ||
@@ -86,2 +87,12 @@ return _super.prototype.getCompletionsForDeclarationProperty.call(this, declaration, result); | ||
}; | ||
SCSSCompletion.prototype.getCompletionForAtDirectives = function (result) { | ||
(_a = result.items).push.apply(_a, SCSSCompletion.scssAtDirectives); | ||
return result; | ||
var _a; | ||
}; | ||
SCSSCompletion.prototype.getCompletionForTopLevel = function (result) { | ||
this.getCompletionForAtDirectives(result); | ||
_super.prototype.getCompletionForTopLevel.call(this, result); | ||
return result; | ||
}; | ||
SCSSCompletion.variableDefaults = { | ||
@@ -186,2 +197,56 @@ '$red': '1', | ||
]; | ||
SCSSCompletion.scssAtDirectives = [ | ||
{ | ||
label: "@extend", | ||
documentation: localize("scss.builtin.@extend", "Inherits the styles of another selector.") | ||
}, | ||
{ | ||
label: "@at-root", | ||
documentation: localize("scss.builtin.@at-root", "Causes one or more rules to be emitted at the root of the document.") | ||
}, | ||
{ | ||
label: "@debug", | ||
documentation: localize("scss.builtin.@debug", "Prints the value of an expression to the standard error output stream. Useful for debugging complicated Sass files.") | ||
}, | ||
{ | ||
label: "@warn", | ||
documentation: localize("scss.builtin.@warn", "Prints the value of an expression to the standard error output stream. Useful for libraries that need to warn users of deprecations or recovering from minor mixin usage mistakes. Warnings can be turned off with the `--quiet` command-line option or the `:quiet` Sass option.") | ||
}, | ||
{ | ||
label: "@error", | ||
documentation: localize("scss.builtin.@error", "Throws the value of an expression as a fatal error with stack trace. Useful for validating arguments to mixins and functions.") | ||
}, | ||
{ | ||
label: "@if", | ||
documentation: localize("scss.builtin.@if", "Includes the body if the expression does not evaluate to `false` or `null`.") | ||
}, | ||
{ | ||
label: "@for", | ||
documentation: localize("scss.builtin.@for", "For loop that repeatedly outputs a set of styles for each `$var` in the `from/through` or `from/to` clause."), | ||
insertText: "@for \\$${1:var} from ${2:start} ${3|to,through|} ${4:end} {\n\t$0\n}", | ||
insertTextFormat: InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@each", | ||
documentation: localize("scss.builtin.@each", "Each loop that sets `$var` to each item in the list or map, then outputs the styles it contains using that value of `$var`."), | ||
insertText: "@each \\$${1:var} in ${2:list} {\n\t$0\n}", | ||
insertTextFormat: InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@while", | ||
documentation: localize("scss.builtin.@while", "While loop that takes an expression and repeatedly outputs the nested styles until the statement evaluates to `false`."), | ||
insertText: "@while ${1:condition} {\n\t$0\n}", | ||
insertTextFormat: InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@mixin", | ||
documentation: localize("scss.builtin.@mixin", "Defines styles that can be re-used throughout the stylesheet with `@include`."), | ||
insertText: "@mixin ${1:name} {\n\t$0\n}", | ||
insertTextFormat: InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@include", | ||
documentation: localize("scss.builtin.@include", "Includes the styles defined by another mixin into the current rule.") | ||
}, | ||
]; | ||
return SCSSCompletion; | ||
@@ -188,0 +253,0 @@ }(CSSCompletion)); |
@@ -260,33 +260,36 @@ /*--------------------------------------------------------------------------------------------- | ||
case nodes.NodeType.AttributeSelector: | ||
var expr = child.getExpression(); | ||
if (expr) { | ||
var selector = child; | ||
var identifuer = selector.getIdentifier(); | ||
if (identifuer) { | ||
var expression = selector.getValue(); | ||
var operator = selector.getOperator(); | ||
var value = void 0; | ||
if (expr.getRight()) { | ||
switch (unescape(expr.getOperator().getText())) { | ||
if (expression) { | ||
switch (unescape(operator.getText())) { | ||
case '|=': | ||
// excatly or followed by -words | ||
value = quotes.remove(unescape(expr.getRight().getText())) + "-\u2026"; | ||
value = quotes.remove(unescape(expression.getText())) + "-\u2026"; | ||
break; | ||
case '^=': | ||
// prefix | ||
value = quotes.remove(unescape(expr.getRight().getText())) + "\u2026"; | ||
value = quotes.remove(unescape(expression.getText())) + "\u2026"; | ||
break; | ||
case '$=': | ||
// suffix | ||
value = "\u2026" + quotes.remove(unescape(expr.getRight().getText())); | ||
value = "\u2026" + quotes.remove(unescape(expression.getText())); | ||
break; | ||
case '~=': | ||
// one of a list of words | ||
value = " \u2026 " + quotes.remove(unescape(expr.getRight().getText())) + " \u2026 "; | ||
value = " \u2026 " + quotes.remove(unescape(expression.getText())) + " \u2026 "; | ||
break; | ||
case '*=': | ||
// substring | ||
value = "\u2026" + quotes.remove(unescape(expr.getRight().getText())) + "\u2026"; | ||
value = "\u2026" + quotes.remove(unescape(expression.getText())) + "\u2026"; | ||
break; | ||
default: | ||
value = quotes.remove(unescape(expr.getRight().getText())); | ||
value = quotes.remove(unescape(expression.getText())); | ||
break; | ||
} | ||
} | ||
result.addAttr(unescape(expr.getLeft().getText()), value); | ||
result.addAttr(unescape(identifuer.getText()), value); | ||
} | ||
@@ -293,0 +296,0 @@ break; |
@@ -22,2 +22,3 @@ (function (factory) { | ||
/// A parser for the css core specification. See for reference: | ||
/// https://www.w3.org/TR/CSS21/grammar.html | ||
/// http://www.w3.org/TR/CSS21/syndata.html#tokenization | ||
@@ -1031,5 +1032,9 @@ /// </summary> | ||
node.setNamespacePrefix(this._parseNamespacePrefix()); | ||
if (!node.setExpression(this._parseBinaryExpr())) { | ||
// is this bad? | ||
if (!node.setIdentifier(this._parseIdent())) { | ||
return this.finish(node, cssErrors_1.ParseError.IdentifierExpected); | ||
} | ||
if (node.setOperator(this._parseOperator())) { | ||
node.setValue(this._parseBinaryExpr()); | ||
this.acceptIdent('i'); // case insensitive matching | ||
} | ||
if (!this.accept(cssScanner_1.TokenType.BracketR)) { | ||
@@ -1109,3 +1114,3 @@ return this.finish(node, cssErrors_1.ParseError.RightSquareBracketExpected); | ||
var node = this.create(nodes.Expression); | ||
if (!node.addChild(this._parseNamedLine() || this._parseBinaryExpr())) { | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
return null; | ||
@@ -1120,3 +1125,3 @@ } | ||
} | ||
if (!node.addChild(this._parseNamedLine() || this._parseBinaryExpr())) { | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
break; | ||
@@ -1170,3 +1175,4 @@ } | ||
node.setExpression(this._parseHexColor()) || | ||
node.setExpression(this._parseOperation())) { | ||
node.setExpression(this._parseOperation()) || | ||
node.setExpression(this._parseNamedLine())) { | ||
return this.finish(node); | ||
@@ -1173,0 +1179,0 @@ } |
@@ -196,2 +196,3 @@ (function (factory) { | ||
staticUnitTable['%'] = TokenType.Percentage; | ||
staticUnitTable['fr'] = TokenType.Percentage; | ||
staticUnitTable['dpi'] = TokenType.Resolution; | ||
@@ -198,0 +199,0 @@ staticUnitTable['dpcm'] = TokenType.Resolution; |
@@ -144,3 +144,3 @@ var __extends = (this && this.__extends) || (function () { | ||
LESSParser.prototype._parseDetachedRuleSetBody = function () { | ||
return this._tryParseKeyframeSelector() || _super.prototype._parseRuleSetDeclaration.call(this); | ||
return this._tryParseKeyframeSelector() || this._tryParseRuleset(true) || _super.prototype._parseRuleSetDeclaration.call(this); | ||
}; | ||
@@ -147,0 +147,0 @@ LESSParser.prototype._parseVariable = function () { |
@@ -107,3 +107,6 @@ var __extends = (this && this.__extends) || (function () { | ||
SCSSParser.prototype._parseKeyframeSelector = function () { | ||
return this._tryParseKeyframeSelector() || this._parseControlStatement(this._parseKeyframeSelector.bind(this)) || this._parseMixinContent(); | ||
return this._tryParseKeyframeSelector() | ||
|| this._parseControlStatement(this._parseKeyframeSelector.bind(this)) | ||
|| this._parseVariableDeclaration() | ||
|| this._parseMixinContent(); | ||
}; | ||
@@ -110,0 +113,0 @@ SCSSParser.prototype._parseVariable = function () { |
@@ -111,2 +111,5 @@ (function (factory) { | ||
this.getCompletionForUriLiteralValue(node, result); | ||
} | ||
else if (node.parent === null) { | ||
this.getCompletionForTopLevel(result); | ||
// } else if (node instanceof nodes.Variable) { | ||
@@ -113,0 +116,0 @@ // this.getCompletionsForVariableDeclaration() |
@@ -295,3 +295,3 @@ (function (factory) { | ||
'resolution': ['dpi', 'dpcm', 'dppx'], | ||
'percentage': ['%'] | ||
'percentage': ['%', 'fr'] | ||
}; | ||
@@ -608,9 +608,22 @@ exports.html5Tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', | ||
exports.getEntryDescription = getEntryDescription; | ||
function expandEntryStatus(status) { | ||
switch (status) { | ||
case 'e': | ||
return 'experimental'; | ||
case 'n': | ||
return 'nonstandard'; | ||
case 'o': | ||
return 'obsolete'; | ||
default: | ||
return 'standard'; | ||
} | ||
} | ||
exports.expandEntryStatus = expandEntryStatus; | ||
function getEntryStatus(status) { | ||
switch (status) { | ||
case 'experimental': | ||
case 'e': | ||
return '⚠️ Property is experimental. Be cautious when using it.️\n\n'; | ||
case 'nonstandard': | ||
case 'n': | ||
return '🚨️ Property is nonstandard. Avoid using it.\n\n'; | ||
case 'obsolete': | ||
case 'o': | ||
return '🚨️️️ Property is obsolete. Avoid using it.\n\n'; | ||
@@ -742,3 +755,3 @@ default: | ||
get: function () { | ||
return this.data.status || 'standard'; | ||
return expandEntryStatus(this.data.status); | ||
}, | ||
@@ -783,3 +796,3 @@ enumerable: true, | ||
atDirectiveList = []; | ||
for (var i = 0, len = atDirectives.length; i < len; i++) { | ||
for (var i = 0; i < atDirectives.length; i++) { | ||
var rawEntry = atDirectives[i]; | ||
@@ -797,3 +810,3 @@ atDirectiveList.push(new EntryImpl(rawEntry)); | ||
pseudoElementList = []; | ||
for (var i = 0, len = pseudoElements.length; i < len; i++) { | ||
for (var i = 0; i < pseudoElements.length; i++) { | ||
var rawEntry = pseudoElements[i]; | ||
@@ -811,3 +824,3 @@ pseudoElementList.push(new EntryImpl(rawEntry)); | ||
pseudoClassesList = []; | ||
for (var i = 0, len = pseudoClasses.length; i < len; i++) { | ||
for (var i = 0; i < pseudoClasses.length; i++) { | ||
var rawEntry = pseudoClasses[i]; | ||
@@ -814,0 +827,0 @@ pseudoClassesList.push(new EntryImpl(rawEntry)); |
@@ -424,9 +424,15 @@ (function (factory) { | ||
///////////////////////////////////////////////////////////// | ||
var value = node.getValue(); | ||
if (!value.unit || languageFacts.units.length.indexOf(value.unit.toLowerCase()) === -1) { | ||
return true; | ||
var decl = node.findParent(nodes.NodeType.Declaration); | ||
if (decl) { | ||
var declValue = decl.getValue(); | ||
if (declValue && declValue.offset === node.offset && declValue.length === node.length) { | ||
var value = node.getValue(); | ||
if (!value.unit || languageFacts.units.length.indexOf(value.unit.toLowerCase()) === -1) { | ||
return true; | ||
} | ||
if (parseFloat(value.value) === 0.0 && !!value.unit) { | ||
this.addEntry(node, lintRules_1.Rules.ZeroWithUnit); | ||
} | ||
} | ||
} | ||
if (parseFloat(value.value) === 0.0 && !!value.unit) { | ||
this.addEntry(node, lintRules_1.Rules.ZeroWithUnit); | ||
} | ||
return true; | ||
@@ -433,0 +439,0 @@ }; |
@@ -79,2 +79,3 @@ var __extends = (this && this.__extends) || (function () { | ||
SCSSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) { | ||
this.getCompletionForAtDirectives(result); | ||
this.getCompletionsForSelector(null, true, result); | ||
@@ -96,2 +97,12 @@ return _super.prototype.getCompletionsForDeclarationProperty.call(this, declaration, result); | ||
}; | ||
SCSSCompletion.prototype.getCompletionForAtDirectives = function (result) { | ||
(_a = result.items).push.apply(_a, SCSSCompletion.scssAtDirectives); | ||
return result; | ||
var _a; | ||
}; | ||
SCSSCompletion.prototype.getCompletionForTopLevel = function (result) { | ||
this.getCompletionForAtDirectives(result); | ||
_super.prototype.getCompletionForTopLevel.call(this, result); | ||
return result; | ||
}; | ||
SCSSCompletion.variableDefaults = { | ||
@@ -196,2 +207,56 @@ '$red': '1', | ||
]; | ||
SCSSCompletion.scssAtDirectives = [ | ||
{ | ||
label: "@extend", | ||
documentation: localize("scss.builtin.@extend", "Inherits the styles of another selector.") | ||
}, | ||
{ | ||
label: "@at-root", | ||
documentation: localize("scss.builtin.@at-root", "Causes one or more rules to be emitted at the root of the document.") | ||
}, | ||
{ | ||
label: "@debug", | ||
documentation: localize("scss.builtin.@debug", "Prints the value of an expression to the standard error output stream. Useful for debugging complicated Sass files.") | ||
}, | ||
{ | ||
label: "@warn", | ||
documentation: localize("scss.builtin.@warn", "Prints the value of an expression to the standard error output stream. Useful for libraries that need to warn users of deprecations or recovering from minor mixin usage mistakes. Warnings can be turned off with the `--quiet` command-line option or the `:quiet` Sass option.") | ||
}, | ||
{ | ||
label: "@error", | ||
documentation: localize("scss.builtin.@error", "Throws the value of an expression as a fatal error with stack trace. Useful for validating arguments to mixins and functions.") | ||
}, | ||
{ | ||
label: "@if", | ||
documentation: localize("scss.builtin.@if", "Includes the body if the expression does not evaluate to `false` or `null`.") | ||
}, | ||
{ | ||
label: "@for", | ||
documentation: localize("scss.builtin.@for", "For loop that repeatedly outputs a set of styles for each `$var` in the `from/through` or `from/to` clause."), | ||
insertText: "@for \\$${1:var} from ${2:start} ${3|to,through|} ${4:end} {\n\t$0\n}", | ||
insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@each", | ||
documentation: localize("scss.builtin.@each", "Each loop that sets `$var` to each item in the list or map, then outputs the styles it contains using that value of `$var`."), | ||
insertText: "@each \\$${1:var} in ${2:list} {\n\t$0\n}", | ||
insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@while", | ||
documentation: localize("scss.builtin.@while", "While loop that takes an expression and repeatedly outputs the nested styles until the statement evaluates to `false`."), | ||
insertText: "@while ${1:condition} {\n\t$0\n}", | ||
insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@mixin", | ||
documentation: localize("scss.builtin.@mixin", "Defines styles that can be re-used throughout the stylesheet with `@include`."), | ||
insertText: "@mixin ${1:name} {\n\t$0\n}", | ||
insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.Snippet | ||
}, | ||
{ | ||
label: "@include", | ||
documentation: localize("scss.builtin.@include", "Includes the styles defined by another mixin into the current rule.") | ||
}, | ||
]; | ||
return SCSSCompletion; | ||
@@ -198,0 +263,0 @@ }(cssCompletion_1.CSSCompletion)); |
@@ -270,33 +270,36 @@ var __extends = (this && this.__extends) || (function () { | ||
case nodes.NodeType.AttributeSelector: | ||
var expr = child.getExpression(); | ||
if (expr) { | ||
var selector = child; | ||
var identifuer = selector.getIdentifier(); | ||
if (identifuer) { | ||
var expression = selector.getValue(); | ||
var operator = selector.getOperator(); | ||
var value = void 0; | ||
if (expr.getRight()) { | ||
switch (unescape(expr.getOperator().getText())) { | ||
if (expression) { | ||
switch (unescape(operator.getText())) { | ||
case '|=': | ||
// excatly or followed by -words | ||
value = quotes.remove(unescape(expr.getRight().getText())) + "-\u2026"; | ||
value = quotes.remove(unescape(expression.getText())) + "-\u2026"; | ||
break; | ||
case '^=': | ||
// prefix | ||
value = quotes.remove(unescape(expr.getRight().getText())) + "\u2026"; | ||
value = quotes.remove(unescape(expression.getText())) + "\u2026"; | ||
break; | ||
case '$=': | ||
// suffix | ||
value = "\u2026" + quotes.remove(unescape(expr.getRight().getText())); | ||
value = "\u2026" + quotes.remove(unescape(expression.getText())); | ||
break; | ||
case '~=': | ||
// one of a list of words | ||
value = " \u2026 " + quotes.remove(unescape(expr.getRight().getText())) + " \u2026 "; | ||
value = " \u2026 " + quotes.remove(unescape(expression.getText())) + " \u2026 "; | ||
break; | ||
case '*=': | ||
// substring | ||
value = "\u2026" + quotes.remove(unescape(expr.getRight().getText())) + "\u2026"; | ||
value = "\u2026" + quotes.remove(unescape(expression.getText())) + "\u2026"; | ||
break; | ||
default: | ||
value = quotes.remove(unescape(expr.getRight().getText())); | ||
value = quotes.remove(unescape(expression.getText())); | ||
break; | ||
} | ||
} | ||
result.addAttr(unescape(expr.getLeft().getText()), value); | ||
result.addAttr(unescape(identifuer.getText()), value); | ||
} | ||
@@ -303,0 +306,0 @@ break; |
{ | ||
"name": "vscode-css-languageservice", | ||
"version": "3.0.9-next.15", | ||
"version": "3.0.9-next.16", | ||
"description": "Language service for CSS, LESS and SCSS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/umd/cssLanguageService.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2103106
45847