monaco-css
Advanced tools
Comparing version 2.1.1 to 2.2.0
{ | ||
"name": "monaco-css", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "CSS, LESS and SCSS plugin for the Monaco Editor", | ||
@@ -22,11 +22,11 @@ "scripts": { | ||
"devDependencies": { | ||
"monaco-editor-core": "0.12.0", | ||
"monaco-languages": "1.0.0", | ||
"monaco-editor-core": "0.14.1", | ||
"monaco-languages": "1.4.0", | ||
"monaco-plugin-helpers": "^1.0.2", | ||
"requirejs": "^2.3.5", | ||
"typescript": "2.7.2", | ||
"uglify-js": "^3.3.14", | ||
"vscode-css-languageservice": "3.0.8", | ||
"vscode-languageserver-types": "3.6.1" | ||
"typescript": "3.0.1", | ||
"uglify-js": "3.4.7", | ||
"vscode-css-languageservice": "3.0.9", | ||
"vscode-languageserver-types": "3.10.0" | ||
} | ||
} |
@@ -6,3 +6,2 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
import { Range, TextEdit } from '../vscode-languageserver-types/main'; | ||
import { Parser } from './parser/cssParser'; | ||
@@ -18,3 +17,5 @@ import { CSSCompletion } from './services/cssCompletion'; | ||
import { LESSCompletion } from './services/lessCompletion'; | ||
export { TextEdit, Range }; | ||
import { getFoldingRanges } from './services/cssFolding'; | ||
export * from './cssLanguageTypes'; | ||
export * from '../vscode-languageserver-types/main'; | ||
function createFacade(parser, completion, hover, navigation, codeActions, validation) { | ||
@@ -37,2 +38,3 @@ return { | ||
doRename: navigation.doRename.bind(navigation), | ||
getFoldingRanges: getFoldingRanges | ||
}; | ||
@@ -39,0 +41,0 @@ } |
@@ -94,2 +94,3 @@ /*--------------------------------------------------------------------------------------------- | ||
NodeType[NodeType["Plugin"] = 71] = "Plugin"; | ||
NodeType[NodeType["UnknownAtRule"] = 72] = "UnknownAtRule"; | ||
})(NodeType || (NodeType = {})); | ||
@@ -129,3 +130,4 @@ export var ReferenceType; | ||
export function getNodePath(node, offset) { | ||
var candidate = getNodeAtOffset(node, offset), path = []; | ||
var candidate = getNodeAtOffset(node, offset); | ||
var path = []; | ||
while (candidate) { | ||
@@ -243,3 +245,3 @@ path.unshift(candidate); | ||
Node.prototype.hasIssue = function (rule) { | ||
return this.issues && this.issues.some(function (i) { return i.getRule() === rule; }); | ||
return Array.isArray(this.issues) && this.issues.some(function (i) { return i.getRule() === rule; }); | ||
}; | ||
@@ -251,3 +253,3 @@ Node.prototype.isErroneous = function (recursive) { | ||
} | ||
return recursive && this.children && this.children.some(function (c) { return c.isErroneous(true); }); | ||
return recursive && Array.isArray(this.children) && this.children.some(function (c) { return c.isErroneous(true); }); | ||
}; | ||
@@ -455,3 +457,3 @@ Node.prototype.setNode = function (field, node, index) { | ||
RuleSet.prototype.isNested = function () { | ||
return this.parent && this.parent.findParent(NodeType.Declarations) !== null; | ||
return !!this.parent && this.parent.findParent(NodeType.Declarations) !== null; | ||
}; | ||
@@ -1210,8 +1212,2 @@ return RuleSet; | ||
}); | ||
AttributeSelector.prototype.setExpression = function (value) { | ||
return this.setNode('expression', value); | ||
}; | ||
AttributeSelector.prototype.getExpression = function () { | ||
return this.expression; | ||
}; | ||
AttributeSelector.prototype.setNamespacePrefix = function (value) { | ||
@@ -1223,2 +1219,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; | ||
@@ -1460,2 +1474,44 @@ }(Node)); | ||
export { MixinDeclaration }; | ||
var UnknownAtRule = /** @class */ (function (_super) { | ||
__extends(UnknownAtRule, _super); | ||
function UnknownAtRule(offset, length) { | ||
return _super.call(this, offset, length) || this; | ||
} | ||
Object.defineProperty(UnknownAtRule.prototype, "type", { | ||
get: function () { | ||
return NodeType.UnknownAtRule; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
UnknownAtRule.prototype.setAtRuleName = function (atRuleName) { | ||
this.atRuleName = atRuleName; | ||
}; | ||
UnknownAtRule.prototype.getAtRuleName = function (atRuleName) { | ||
return this.atRuleName; | ||
}; | ||
return UnknownAtRule; | ||
}(BodyDeclaration)); | ||
export { UnknownAtRule }; | ||
var ListEntry = /** @class */ (function (_super) { | ||
__extends(ListEntry, _super); | ||
function ListEntry() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
Object.defineProperty(ListEntry.prototype, "type", { | ||
get: function () { | ||
return NodeType.ListEntry; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
ListEntry.prototype.setKey = function (node) { | ||
return this.setNode('key', node, 0); | ||
}; | ||
ListEntry.prototype.setValue = function (node) { | ||
return this.setNode('value', node, 1); | ||
}; | ||
return ListEntry; | ||
}(Node)); | ||
export { ListEntry }; | ||
var LessGuard = /** @class */ (function (_super) { | ||
@@ -1462,0 +1518,0 @@ __extends(LessGuard, _super); |
@@ -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 | ||
@@ -163,3 +164,3 @@ /// </summary> | ||
Parser.prototype.markError = function (node, error, resyncTokens, resyncStopTokens) { | ||
if (this.token !== this.lastErrorToken) { | ||
if (this.token !== this.lastErrorToken) { // do not report twice on the same token | ||
node.addIssue(new nodes.Marker(node, error, nodes.Level.Error, null, this.token.offset, this.token.len)); | ||
@@ -237,14 +238,18 @@ this.lastErrorToken = this.token; | ||
if (this.peek(TokenType.AtKeyword)) { | ||
return this._parseImport() | ||
|| this._parseMedia() | ||
|| this._parsePage() | ||
|| this._parseFontFace() | ||
|| this._parseKeyframe() | ||
|| this._parseSupports() | ||
|| this._parseViewPort() | ||
|| this._parseNamespace() | ||
|| this._parseDocument(); | ||
return this._parseStylesheetAtStatement(); | ||
} | ||
return this._parseRuleset(false); | ||
}; | ||
Parser.prototype._parseStylesheetAtStatement = function () { | ||
return this._parseImport() | ||
|| this._parseMedia() | ||
|| this._parsePage() | ||
|| this._parseFontFace() | ||
|| this._parseKeyframe() | ||
|| this._parseSupports() | ||
|| this._parseViewPort() | ||
|| this._parseNamespace() | ||
|| this._parseDocument() | ||
|| this._parseUnknownAtRule(); | ||
}; | ||
Parser.prototype._tryParseRuleset = function (isNested) { | ||
@@ -495,3 +500,3 @@ var mark = this.mark(); | ||
break; | ||
case TokenType.BadString:// fall through | ||
case TokenType.BadString: // fall through | ||
break done; | ||
@@ -578,3 +583,3 @@ case TokenType.EOF: | ||
this.consumeToken(); // @namespace | ||
if (!node.addChild(this._parseURILiteral())) { | ||
if (!node.addChild(this._parseURILiteral())) { // url literal also starts with ident | ||
node.addChild(this._parseIdent()); // optional prefix | ||
@@ -616,3 +621,3 @@ if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { | ||
node.setKeyword(this.finish(atNode)); | ||
if (atNode.getText() === '@-ms-keyframes') { | ||
if (atNode.getText() === '@-ms-keyframes') { // -ms-keyframes never existed | ||
this.markError(atNode, ParseError.UnknownKeyword); | ||
@@ -694,3 +699,3 @@ } | ||
if (this.peekRegExp(TokenType.Ident, /^(and|or)$/i)) { | ||
var text = this.token.text; | ||
var text = this.token.text.toLowerCase(); | ||
while (this.acceptIdent(text)) { | ||
@@ -864,3 +869,3 @@ node.addChild(this._parseSupportsConditionInParens()); | ||
if (this.accept(TokenType.Colon)) { | ||
if (!node.addChild(this._parseIdent())) { | ||
if (!node.addChild(this._parseIdent())) { // optional ident | ||
return this.finish(node, ParseError.IdentifierExpected); | ||
@@ -881,2 +886,87 @@ } | ||
}; | ||
// https://www.w3.org/TR/css-syntax-3/#consume-an-at-rule | ||
Parser.prototype._parseUnknownAtRule = function () { | ||
var node = this.create(nodes.UnknownAtRule); | ||
node.addChild(this._parseUnknownAtRuleName()); | ||
var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; }; | ||
var curlyLCount = 0; | ||
var curlyDepth = 0; | ||
var parensDepth = 0; | ||
var bracketsDepth = 0; | ||
done: while (true) { | ||
switch (this.token.type) { | ||
case TokenType.SemiColon: | ||
if (isTopLevel()) { | ||
break done; | ||
} | ||
break; | ||
case TokenType.EOF: | ||
if (curlyDepth > 0) { | ||
return this.finish(node, ParseError.RightCurlyExpected); | ||
} | ||
else if (bracketsDepth > 0) { | ||
return this.finish(node, ParseError.RightSquareBracketExpected); | ||
} | ||
else if (parensDepth > 0) { | ||
return this.finish(node, ParseError.RightParenthesisExpected); | ||
} | ||
else { | ||
return this.finish(node); | ||
} | ||
case TokenType.CurlyL: | ||
curlyLCount++; | ||
curlyDepth++; | ||
break; | ||
case TokenType.CurlyR: | ||
curlyDepth--; | ||
// End of at-rule, consume CurlyR and return node | ||
if (curlyLCount > 0 && curlyDepth === 0) { | ||
this.consumeToken(); | ||
if (bracketsDepth > 0) { | ||
return this.finish(node, ParseError.RightSquareBracketExpected); | ||
} | ||
else if (parensDepth > 0) { | ||
return this.finish(node, ParseError.RightParenthesisExpected); | ||
} | ||
break done; | ||
} | ||
if (curlyDepth < 0) { | ||
// The property value has been terminated without a semicolon, and | ||
// this is the last declaration in the ruleset. | ||
if (parensDepth === 0 && bracketsDepth === 0) { | ||
break done; | ||
} | ||
return this.finish(node, ParseError.LeftCurlyExpected); | ||
} | ||
break; | ||
case TokenType.ParenthesisL: | ||
parensDepth++; | ||
break; | ||
case TokenType.ParenthesisR: | ||
parensDepth--; | ||
if (parensDepth < 0) { | ||
return this.finish(node, ParseError.LeftParenthesisExpected); | ||
} | ||
break; | ||
case TokenType.BracketL: | ||
bracketsDepth++; | ||
break; | ||
case TokenType.BracketR: | ||
bracketsDepth--; | ||
if (bracketsDepth < 0) { | ||
return this.finish(node, ParseError.LeftSquareBracketExpected); | ||
} | ||
break; | ||
} | ||
this.consumeToken(); | ||
} | ||
return node; | ||
}; | ||
Parser.prototype._parseUnknownAtRuleName = function () { | ||
var node = this.create(nodes.Node); | ||
if (this.accept(TokenType.AtKeyword)) { | ||
return this.finish(node); | ||
} | ||
return node; | ||
}; | ||
Parser.prototype._parseOperator = function () { | ||
@@ -893,3 +983,3 @@ // these are operators for binary expressions | ||
this.peek(TokenType.SuffixOperator) || | ||
this.peekDelim('=')) { | ||
this.peekDelim('=')) { // doesn't stick to the standard here | ||
var node = this.createNode(nodes.NodeType.Operator); | ||
@@ -1030,5 +1120,9 @@ this.consumeToken(); | ||
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)) { | ||
@@ -1042,23 +1136,16 @@ return this.finish(node, ParseError.RightSquareBracketExpected); | ||
// pseudo: ':' [ IDENT | FUNCTION S* [IDENT S*]? ')' ] | ||
if (!this.peek(TokenType.Colon)) { | ||
return null; | ||
} | ||
var pos = this.mark(); | ||
var node = this.createNode(nodes.NodeType.PseudoSelector); | ||
this.consumeToken(); // Colon | ||
if (!this.hasWhitespace()) { | ||
// optional, support :: | ||
if (this.accept(TokenType.Colon) && this.hasWhitespace()) { | ||
return this.finish(node, ParseError.IdentifierExpected); | ||
} | ||
if (!node.addChild(this._parseIdent())) { | ||
return this.finish(node, ParseError.IdentifierExpected); | ||
} | ||
var node = this._tryParsePseudoIdentifier(); | ||
if (node) { | ||
if (!this.hasWhitespace() && this.accept(TokenType.ParenthesisL)) { | ||
var tryAsSelector = function () { | ||
var selector = _this._parseSimpleSelector(); | ||
if (selector && _this.peek(TokenType.ParenthesisR)) { | ||
return selector; | ||
var selectors = _this.create(nodes.Node); | ||
if (!selectors.addChild(_this._parseSelector(false))) { | ||
return null; | ||
} | ||
return null; | ||
while (_this.accept(TokenType.Comma) && selectors.addChild(_this._parseSelector(false))) { | ||
// loop | ||
} | ||
if (_this.peek(TokenType.ParenthesisR)) { | ||
return _this.finish(selectors); | ||
} | ||
}; | ||
@@ -1072,5 +1159,24 @@ node.addChild(this.try(tryAsSelector) || this._parseBinaryExpr()); | ||
} | ||
this.restoreAtMark(pos); | ||
return null; | ||
}; | ||
Parser.prototype._tryParsePseudoIdentifier = function () { | ||
if (!this.peek(TokenType.Colon)) { | ||
return null; | ||
} | ||
var pos = this.mark(); | ||
var node = this.createNode(nodes.NodeType.PseudoSelector); | ||
this.consumeToken(); // Colon | ||
if (this.hasWhitespace()) { | ||
this.restoreAtMark(pos); | ||
return null; | ||
} | ||
// optional, support :: | ||
if (this.accept(TokenType.Colon) && this.hasWhitespace()) { | ||
this.markError(node, ParseError.IdentifierExpected); | ||
} | ||
if (!node.addChild(this._parseIdent())) { | ||
this.markError(node, ParseError.IdentifierExpected); | ||
} | ||
return node; | ||
}; | ||
Parser.prototype._tryParsePrio = function () { | ||
@@ -1098,7 +1204,7 @@ var mark = this.mark(); | ||
var node = this.create(nodes.Expression); | ||
if (!node.addChild(this._parseNamedLine() || this._parseBinaryExpr())) { | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
return null; | ||
} | ||
while (true) { | ||
if (this.peek(TokenType.Comma)) { | ||
if (this.peek(TokenType.Comma)) { // optional | ||
if (stopOnComma) { | ||
@@ -1109,3 +1215,3 @@ return this.finish(node); | ||
} | ||
if (!node.addChild(this._parseNamedLine() || this._parseBinaryExpr())) { | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
break; | ||
@@ -1159,3 +1265,4 @@ } | ||
node.setExpression(this._parseHexColor()) || | ||
node.setExpression(this._parseOperation())) { | ||
node.setExpression(this._parseOperation()) || | ||
node.setExpression(this._parseNamedLine())) { | ||
return this.finish(node); | ||
@@ -1162,0 +1269,0 @@ } |
@@ -186,2 +186,3 @@ /*--------------------------------------------------------------------------------------------- | ||
staticUnitTable['%'] = TokenType.Percentage; | ||
staticUnitTable['fr'] = TokenType.Percentage; | ||
staticUnitTable['dpi'] = TokenType.Resolution; | ||
@@ -191,2 +192,3 @@ staticUnitTable['dpcm'] = TokenType.Resolution; | ||
function Scanner() { | ||
this.stream = new MultiLineStream(''); | ||
this.ignoreComment = true; | ||
@@ -548,3 +550,3 @@ this.ignoreWhitespace = true; | ||
ch >= _A && ch <= _Z || // A-Z | ||
ch >= 0x80 && ch <= 0xFFFF) { | ||
ch >= 0x80 && ch <= 0xFFFF) { // nonascii | ||
this.stream.advance(1); | ||
@@ -572,3 +574,3 @@ result.push(String.fromCharCode(ch)); | ||
ch >= _0 && ch <= _9 || // 0/9 | ||
ch >= 0x80 && ch <= 0xFFFF) { | ||
ch >= 0x80 && ch <= 0xFFFF) { // nonascii | ||
this.stream.advance(1); | ||
@@ -575,0 +577,0 @@ result.push(String.fromCharCode(ch)); |
@@ -98,3 +98,5 @@ /*--------------------------------------------------------------------------------------------- | ||
var current = this.scope.findScope(node.offset, node.length); | ||
current.addSymbol(new Symbol(name, value, node, type)); | ||
if (current) { | ||
current.addSymbol(new Symbol(name, value, node, type)); | ||
} | ||
} | ||
@@ -105,3 +107,3 @@ }; | ||
var current = this.scope.findScope(node.offset, node.length); | ||
if (current.offset !== node.offset || current.length !== node.length) { | ||
if (current && (current.offset !== node.offset || current.length !== node.length)) { // scope already known? | ||
var newScope = new Scope(node.offset, node.length); | ||
@@ -118,3 +120,5 @@ current.addChild(newScope); | ||
var current = this.addScope(scopeNode); // create the scope or gets the existing one | ||
current.addSymbol(new Symbol(name, value, node, type)); | ||
if (current) { | ||
current.addSymbol(new Symbol(name, value, node, type)); | ||
} | ||
} | ||
@@ -125,3 +129,3 @@ }; | ||
case nodes.NodeType.Keyframe: | ||
this.addSymbol(node, node.getName(), null, nodes.ReferenceType.Keyframe); | ||
this.addSymbol(node, node.getName(), void 0, nodes.ReferenceType.Keyframe); | ||
return true; | ||
@@ -135,6 +139,6 @@ case nodes.NodeType.CustomPropertyDeclaration: | ||
case nodes.NodeType.MixinDeclaration: | ||
this.addSymbol(node, node.getName(), null, nodes.ReferenceType.Mixin); | ||
this.addSymbol(node, node.getName(), void 0, nodes.ReferenceType.Mixin); | ||
return true; | ||
case nodes.NodeType.FunctionDeclaration: | ||
this.addSymbol(node, node.getName(), null, nodes.ReferenceType.Function); | ||
this.addSymbol(node, node.getName(), void 0, nodes.ReferenceType.Function); | ||
return true; | ||
@@ -151,3 +155,3 @@ case nodes.NodeType.FunctionParameter: { | ||
if (scopeNode) { | ||
this.addSymbolToChildScope(scopeNode, forNode.variable, forNode.variable.getName(), null, nodes.ReferenceType.Variable); | ||
this.addSymbolToChildScope(scopeNode, forNode.variable, forNode.variable.getName(), void 0, nodes.ReferenceType.Variable); | ||
} | ||
@@ -162,3 +166,3 @@ return true; | ||
var variable = variables_1[_i]; | ||
this.addSymbolToChildScope(scopeNode_1, variable, variable.getName(), null, nodes.ReferenceType.Variable); | ||
this.addSymbolToChildScope(scopeNode_1, variable, variable.getName(), void 0, nodes.ReferenceType.Variable); | ||
} | ||
@@ -173,7 +177,9 @@ } | ||
var current = this.scope.findScope(node.offset, node.length); | ||
for (var _i = 0, _a = node.getSelectors().getChildren(); _i < _a.length; _i++) { | ||
var child = _a[_i]; | ||
if (child instanceof nodes.Selector) { | ||
if (child.getChildren().length === 1) { | ||
current.addSymbol(new Symbol(child.getChild(0).getText(), null, child, nodes.ReferenceType.Rule)); | ||
if (current) { | ||
for (var _i = 0, _a = node.getSelectors().getChildren(); _i < _a.length; _i++) { | ||
var child = _a[_i]; | ||
if (child instanceof nodes.Selector) { | ||
if (child.getChildren().length === 1) { // only selectors with a single element can be extended | ||
current.addSymbol(new Symbol(child.getChild(0).getText(), void 0, child, nodes.ReferenceType.Rule)); | ||
} | ||
} | ||
@@ -185,3 +191,3 @@ } | ||
ScopeBuilder.prototype.visitVariableDeclarationNode = function (node) { | ||
var value = node.getValue() ? node.getValue().getText() : null; | ||
var value = node.getValue() ? node.getValue().getText() : void 0; | ||
this.addSymbol(node, node.getName(), value, nodes.ReferenceType.Variable); | ||
@@ -195,3 +201,3 @@ return true; | ||
var valueNode = node.getDefaultValue(); | ||
var value = valueNode ? valueNode.getText() : null; | ||
var value = valueNode ? valueNode.getText() : void 0; | ||
this.addSymbolToChildScope(scopeNode, node, node.getName(), value, nodes.ReferenceType.Variable); | ||
@@ -208,13 +214,5 @@ } | ||
if (node.offset !== -1) { | ||
var globalScope = this.getGlobalScope(node, name, type); | ||
globalScope.addSymbol(new Symbol(name, value, node, type)); | ||
this.scope.addSymbol(new Symbol(name, value, node, type)); | ||
} | ||
}; | ||
ScopeBuilder.prototype.getGlobalScope = function (node, name, type) { | ||
var current = this.scope.findScope(node.offset, node.length); | ||
while (current.parent !== null) { | ||
current = current.parent; | ||
} | ||
return current; | ||
}; | ||
return ScopeBuilder; | ||
@@ -325,3 +323,3 @@ }()); | ||
if (!node) { | ||
return null; | ||
return false; | ||
} | ||
@@ -328,0 +326,0 @@ while (node.type === nodes.NodeType.Interpolation) { |
@@ -31,7 +31,10 @@ /*--------------------------------------------------------------------------------------------- | ||
LESSParser.prototype._parseStylesheetStatement = function () { | ||
if (this.peek(TokenType.AtKeyword)) { | ||
return this._parseVariableDeclaration() | ||
|| this._parsePlugin() | ||
|| _super.prototype._parseStylesheetAtStatement.call(this); | ||
} | ||
return this._tryParseMixinDeclaration() | ||
|| this._tryParseMixinReference(true) | ||
|| _super.prototype._parseStylesheetStatement.call(this) | ||
|| this._parseVariableDeclaration() | ||
|| this._parsePlugin(); | ||
|| this._parseRuleset(true); | ||
}; | ||
@@ -135,3 +138,3 @@ LESSParser.prototype._parseImport = function () { | ||
LESSParser.prototype._parseDetachedRuleSetBody = function () { | ||
return this._tryParseKeyframeSelector() || _super.prototype._parseRuleSetDeclaration.call(this); | ||
return this._tryParseKeyframeSelector() || this._tryParseRuleset(true) || _super.prototype._parseRuleSetDeclaration.call(this); | ||
}; | ||
@@ -138,0 +141,0 @@ LESSParser.prototype._parseVariable = function () { |
@@ -32,6 +32,2 @@ /*--------------------------------------------------------------------------------------------- | ||
SCSSParser.prototype._parseStylesheetStatement = function () { | ||
var node = _super.prototype._parseStylesheetStatement.call(this); | ||
if (node) { | ||
return node; | ||
} | ||
if (this.peek(TokenType.AtKeyword)) { | ||
@@ -43,5 +39,6 @@ return this._parseWarnAndDebug() | ||
|| this._parseMixinReference() // @include | ||
|| this._parseFunctionDeclaration(); | ||
|| this._parseFunctionDeclaration() | ||
|| _super.prototype._parseStylesheetAtStatement.call(this); | ||
} | ||
return this._parseVariableDeclaration(); | ||
return this._parseRuleset(true) || this._parseVariableDeclaration(); | ||
}; | ||
@@ -99,3 +96,6 @@ SCSSParser.prototype._parseImport = 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(); | ||
}; | ||
@@ -158,3 +158,6 @@ SCSSParser.prototype._parseVariable = function () { | ||
this.consumeToken(); | ||
if (!node.addChild(this._parseBinaryExpr()) && !this._parseSelectorCombinator()) { | ||
if (!node.addChild(this._parseExpr()) && !this._parseSelectorCombinator()) { | ||
if (this.accept(TokenType.CurlyR)) { | ||
return this.finish(node); | ||
} | ||
return this.finish(node, ParseError.ExpressionExpected); | ||
@@ -287,2 +290,14 @@ } | ||
}; | ||
SCSSParser.prototype._parseElementName = function () { | ||
var pos = this.mark(); | ||
var node = _super.prototype._parseElementName.call(this); | ||
if (node && !this.hasWhitespace() && this.peek(TokenType.ParenthesisL)) { // for #49589 | ||
this.restoreAtMark(pos); | ||
return null; | ||
} | ||
return node; | ||
}; | ||
SCSSParser.prototype._tryParsePseudoIdentifier = function () { | ||
return this._parseInterpolation() || _super.prototype._tryParsePseudoIdentifier.call(this); // for #49589 | ||
}; | ||
SCSSParser.prototype._parseWarnAndDebug = function () { | ||
@@ -513,3 +528,3 @@ if (!this.peekKeyword('@debug') | ||
if (!this.accept(TokenType.Colon)) { | ||
if (this.accept(scssScanner.Ellipsis)) { | ||
if (this.accept(scssScanner.Ellipsis)) { // optional | ||
node.setValue(argument); | ||
@@ -559,11 +574,16 @@ return this.finish(node); | ||
SCSSParser.prototype._parseListElement = function () { | ||
var node = this.createNode(nodes.NodeType.ListEntry); | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
var node = this.create(nodes.ListEntry); | ||
var child = this._parseBinaryExpr(); | ||
if (!child) { | ||
return null; | ||
} | ||
if (this.accept(TokenType.Colon)) { | ||
if (!node.addChild(this._parseBinaryExpr())) { | ||
node.setKey(child); | ||
if (!node.setValue(this._parseBinaryExpr())) { | ||
return this.finish(node, ParseError.ExpressionExpected); | ||
} | ||
} | ||
else { | ||
node.setValue(child); | ||
} | ||
return this.finish(node); | ||
@@ -570,0 +590,0 @@ }; |
@@ -49,3 +49,8 @@ /*--------------------------------------------------------------------------------------------- | ||
else if (node instanceof nodes.Expression) { | ||
this.getCompletionsForExpression(node, result); | ||
if (node.parent instanceof nodes.Interpolation) { | ||
this.getVariableProposals(null, result); | ||
} | ||
else { | ||
this.getCompletionsForExpression(node, result); | ||
} | ||
} | ||
@@ -95,3 +100,14 @@ else if (node instanceof nodes.SimpleSelector) { | ||
} | ||
if (result.items.length > 0) { | ||
else if (node.type === nodes.NodeType.URILiteral) { | ||
this.getCompletionForUriLiteralValue(node, result); | ||
} | ||
else if (node.parent === null) { | ||
this.getCompletionForTopLevel(result); | ||
// } else if (node instanceof nodes.Variable) { | ||
// this.getCompletionsForVariableDeclaration() | ||
} | ||
else { | ||
continue; | ||
} | ||
if (result.items.length > 0 || this.offset > node.offset) { | ||
return this.finalize(result); | ||
@@ -156,5 +172,10 @@ } | ||
var insertText = void 0; | ||
var retrigger = false; | ||
if (declaration) { | ||
range = this.getCompletionRange(declaration.getProperty()); | ||
insertText = entry.name + (!isDefined(declaration.colonPosition) ? ': ' : ''); | ||
insertText = entry.name; | ||
if (!isDefined(declaration.colonPosition)) { | ||
insertText += ': '; | ||
retrigger = true; | ||
} | ||
} | ||
@@ -164,2 +185,3 @@ else { | ||
insertText = entry.name + ': '; | ||
retrigger = true; | ||
} | ||
@@ -170,8 +192,13 @@ var item = { | ||
textEdit: TextEdit.replace(range, insertText), | ||
kind: CompletionItemKind.Property, | ||
command: { | ||
kind: CompletionItemKind.Property | ||
}; | ||
if (entry.restrictions.length === 1 && entry.restrictions[0] === 'none') { | ||
retrigger = false; | ||
} | ||
if (retrigger) { | ||
item.command = { | ||
title: 'Suggest', | ||
command: 'editor.action.triggerSuggest' | ||
} | ||
}; | ||
}; | ||
} | ||
if (strings.startsWith(entry.name, '-')) { | ||
@@ -185,6 +212,8 @@ item.sortText = 'x'; | ||
this.completionParticipants.forEach(function (participant) { | ||
participant.onCssProperty({ | ||
propertyName: _this.currentWord, | ||
range: _this.defaultReplaceRange | ||
}); | ||
if (participant.onCssProperty) { | ||
participant.onCssProperty({ | ||
propertyName: _this.currentWord, | ||
range: _this.defaultReplaceRange | ||
}); | ||
} | ||
}); | ||
@@ -202,7 +231,9 @@ return result; | ||
this.completionParticipants.forEach(function (participant) { | ||
participant.onCssPropertyValue({ | ||
propertyName: propertyName, | ||
propertyValue: _this.currentWord, | ||
range: _this.getCompletionRange(existingNode) | ||
}); | ||
if (participant.onCssPropertyValue) { | ||
participant.onCssPropertyValue({ | ||
propertyName: propertyName, | ||
propertyValue: _this.currentWord, | ||
range: _this.getCompletionRange(existingNode) | ||
}); | ||
} | ||
}); | ||
@@ -268,3 +299,3 @@ if (entry) { | ||
var value = _a[_i]; | ||
if (languageFacts.isCommonValue(value)) { | ||
if (languageFacts.isCommonValue(value)) { // only show if supported by more than one browser | ||
var insertString = value.name; | ||
@@ -404,3 +435,3 @@ var insertTextFormat = void 0; | ||
var colorValues = new Set(); | ||
this.styleSheet.acceptVisitor(new ColorValueCollector(colorValues)); | ||
this.styleSheet.acceptVisitor(new ColorValueCollector(colorValues, this.offset)); | ||
for (var _i = 0, _a = colorValues.getEntries(); _i < _a.length; _i++) { | ||
@@ -622,3 +653,3 @@ var color = _a[_i]; | ||
} | ||
if (!isNested) { | ||
if (!isNested) { // show html tags only for top level | ||
for (var _d = 0, _e = languageFacts.html5Tags; _d < _e.length; _d++) { | ||
@@ -668,3 +699,3 @@ var entry = _e[_d]; | ||
CSSCompletion.prototype.getCompletionsForDeclarations = function (declarations, result) { | ||
if (!declarations || this.offset === declarations.offset) { | ||
if (!declarations || this.offset === declarations.offset) { // incomplete nodes | ||
return result; | ||
@@ -697,2 +728,5 @@ } | ||
} | ||
else if (this.currentWord && this.currentWord[0] === '@') { | ||
this.getCompletionsForDeclarationProperty(null, result); | ||
} | ||
return result; | ||
@@ -810,2 +844,30 @@ }; | ||
}; | ||
CSSCompletion.prototype.getCompletionForUriLiteralValue = function (uriLiteralNode, result) { | ||
var uriValue; | ||
var position; | ||
var range; | ||
// No children, empty value | ||
if (uriLiteralNode.getChildren().length === 0) { | ||
uriValue = ''; | ||
position = this.position; | ||
var emptyURIValuePosition = this.textDocument.positionAt(uriLiteralNode.offset + 'url('.length); | ||
range = Range.create(emptyURIValuePosition, emptyURIValuePosition); | ||
} | ||
else { | ||
var uriValueNode = uriLiteralNode.getChild(0); | ||
uriValue = uriValueNode.getText(); | ||
position = this.position; | ||
range = this.getCompletionRange(uriValueNode); | ||
} | ||
this.completionParticipants.forEach(function (participant) { | ||
if (participant.onCssURILiteralValue) { | ||
participant.onCssURILiteralValue({ | ||
uriValue: uriValue, | ||
position: position, | ||
range: range | ||
}); | ||
} | ||
}); | ||
return result; | ||
}; | ||
return CSSCompletion; | ||
@@ -857,4 +919,5 @@ }()); | ||
var ColorValueCollector = /** @class */ (function () { | ||
function ColorValueCollector(entries) { | ||
function ColorValueCollector(entries, currentOffset) { | ||
this.entries = entries; | ||
this.currentOffset = currentOffset; | ||
// nothing to do | ||
@@ -864,3 +927,5 @@ } | ||
if (node instanceof nodes.HexColorValue || (node instanceof nodes.Function && languageFacts.isColorConstructor(node))) { | ||
this.entries.add(node.getText()); | ||
if (this.currentOffset < node.offset || node.end < this.currentOffset) { | ||
this.entries.add(node.getText()); | ||
} | ||
} | ||
@@ -867,0 +932,0 @@ return true; |
@@ -150,2 +150,3 @@ /*--------------------------------------------------------------------------------------------- | ||
CSSNavigation.prototype.doRename = function (document, position, newName, stylesheet) { | ||
var _a; | ||
var highlights = this.findDocumentHighlights(document, position, stylesheet); | ||
@@ -156,3 +157,2 @@ var edits = highlights.map(function (h) { return TextEdit.replace(h.range, newName); }); | ||
}; | ||
var _a; | ||
}; | ||
@@ -159,0 +159,0 @@ return CSSNavigation; |
@@ -285,3 +285,3 @@ /*--------------------------------------------------------------------------------------------- | ||
'resolution': ['dpi', 'dpcm', 'dppx'], | ||
'percentage': ['%'] | ||
'percentage': ['%', 'fr'] | ||
}; | ||
@@ -316,3 +316,3 @@ export var html5Tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', | ||
else if (node.type === nodes.NodeType.Function) { | ||
return this.isColorConstructor(node); | ||
return isColorConstructor(node); | ||
} | ||
@@ -496,2 +496,9 @@ else if (node.type === nodes.NodeType.Identifier) { | ||
} | ||
var term = node.parent; | ||
if (term.parent && term.parent.type === nodes.NodeType.BinaryExpression) { | ||
var expression = term.parent; | ||
if (expression.parent && expression.parent.type === nodes.NodeType.ListEntry && expression.parent.key === expression) { | ||
return null; | ||
} | ||
} | ||
var candidateColor = node.getText().toLowerCase(); | ||
@@ -542,2 +549,12 @@ if (candidateColor === 'none') { | ||
} | ||
export function isStandardProperty(name) { | ||
if (!name) { | ||
return false; | ||
} | ||
else { | ||
name = name.toLowerCase(); | ||
var property = getProperties()[name]; | ||
return property && property.status === 'standard'; | ||
} | ||
} | ||
export function isCommonValue(entry) { | ||
@@ -554,12 +571,43 @@ return entry.browsers.count > 1; | ||
export function getEntryDescription(entry) { | ||
var desc = entry.description || ''; | ||
var browserLabel = this.getBrowserLabel(entry.browsers); | ||
if (!entry.description || entry.description === '') { | ||
return null; | ||
} | ||
var desc = ''; | ||
if (entry.data && entry.data.status) { | ||
desc += getEntryStatus(entry.data.status); | ||
} | ||
desc += entry.description; | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
if (desc) { | ||
desc = desc + '\n'; | ||
} | ||
desc = desc + '(' + browserLabel + ')'; | ||
desc += '\n(' + browserLabel + ')'; | ||
} | ||
if (entry.data && entry.data.syntax) { | ||
desc += "\n\nSyntax: " + entry.data.syntax; | ||
} | ||
return desc; | ||
} | ||
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 'e': | ||
return '⚠️ Property is experimental. Be cautious when using it.️\n\n'; | ||
case 'n': | ||
return '🚨️ Property is nonstandard. Avoid using it.\n\n'; | ||
case 'o': | ||
return '🚨️️️ Property is obsolete. Avoid using it.\n\n'; | ||
default: | ||
return ''; | ||
} | ||
} | ||
export function getBrowserLabel(b) { | ||
@@ -683,2 +731,9 @@ var result = ''; | ||
}); | ||
Object.defineProperty(EntryImpl.prototype, "status", { | ||
get: function () { | ||
return expandEntryStatus(this.data.status); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(EntryImpl.prototype, "values", { | ||
@@ -706,3 +761,3 @@ get: function () { | ||
propertySet = {}; | ||
for (var i = 0, len = properties.length; i < len; i++) { | ||
for (var i = 0; i < properties.length; i++) { | ||
var rawEntry = properties[i]; | ||
@@ -719,3 +774,3 @@ propertySet[rawEntry.name] = new EntryImpl(rawEntry); | ||
atDirectiveList = []; | ||
for (var i = 0, len = atDirectives.length; i < len; i++) { | ||
for (var i = 0; i < atDirectives.length; i++) { | ||
var rawEntry = atDirectives[i]; | ||
@@ -732,3 +787,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]; | ||
@@ -745,3 +800,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]; | ||
@@ -748,0 +803,0 @@ pseudoClassesList.push(new EntryImpl(rawEntry)); |
@@ -115,2 +115,4 @@ /*--------------------------------------------------------------------------------------------- | ||
switch (node.type) { | ||
case nodes.NodeType.UnknownAtRule: | ||
return this.visitUnknownAtRule(node); | ||
case nodes.NodeType.Keyframe: | ||
@@ -140,2 +142,10 @@ return this.visitKeyframe(node); | ||
}; | ||
LintVisitor.prototype.visitUnknownAtRule = function (node) { | ||
var atRuleName = node.getChild(0); | ||
if (!atRuleName) { | ||
return false; | ||
} | ||
this.addEntry(atRuleName, Rules.UnknownAtRules, "Unknown at rule " + atRuleName.getText()); | ||
return true; | ||
}; | ||
LintVisitor.prototype.visitKeyframe = function (node) { | ||
@@ -231,5 +241,5 @@ var keyword = node.getKeyword(); | ||
var p = _c[_b]; | ||
var elements_1 = this.fetch(propertyTable, p); | ||
for (var _d = 0, elements_2 = elements_1; _d < elements_2.length; _d++) { | ||
var element = elements_2[_d]; | ||
var elements_3 = this.fetch(propertyTable, p); | ||
for (var _d = 0, elements_1 = elements_3; _d < elements_1.length; _d++) { | ||
var element = elements_1[_d]; | ||
var value = element.node.getValue(); | ||
@@ -254,5 +264,5 @@ if (value && !value.matches('none')) { | ||
var p = _g[_f]; | ||
var elements_3 = this.fetch(propertyTable, p); | ||
for (var _h = 0, elements_4 = elements_3; _h < elements_4.length; _h++) { | ||
var element = elements_4[_h]; | ||
var elements_4 = this.fetch(propertyTable, p); | ||
for (var _h = 0, elements_2 = elements_4; _h < elements_2.length; _h++) { | ||
var element = elements_2[_h]; | ||
var value = element.node.getValue(); | ||
@@ -351,3 +361,3 @@ if (value && !value.matches('none')) { | ||
if (firstChar === '-') { | ||
if (name.charAt(1) !== '-') { | ||
if (name.charAt(1) !== '-') { // avoid css variables | ||
if (!languageFacts.isKnownProperty(name)) { | ||
@@ -375,7 +385,7 @@ this.addEntry(decl.getProperty(), Rules.UnknownVendorSpecificProperty); | ||
} | ||
if (!containsUnknowns) { | ||
if (!containsUnknowns) { // don't perform this test if there are | ||
for (var suffix in propertiesBySuffix.data) { | ||
var entry = propertiesBySuffix.data[suffix]; | ||
var actual = entry.names; | ||
var needsStandard = languageFacts.isKnownProperty(suffix) && (actual.indexOf(suffix) === -1); | ||
var needsStandard = languageFacts.isStandardProperty(suffix) && (actual.indexOf(suffix) === -1); | ||
if (!needsStandard && actual.length === 1) { | ||
@@ -387,3 +397,3 @@ continue; // only the non-vendor specific rule is used, that's fine, no warning | ||
var prefix = LintVisitor.prefixes[i]; | ||
if (languageFacts.isKnownProperty(prefix + suffix)) { | ||
if (languageFacts.isStandardProperty(prefix + suffix)) { | ||
expected.push(prefix + suffix); | ||
@@ -421,9 +431,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; | ||
@@ -430,0 +446,0 @@ }; |
@@ -35,2 +35,3 @@ /*--------------------------------------------------------------------------------------------- | ||
UnknownProperty: new Rule('unknownProperties', localize('rule.unknownProperty', "Unknown property."), Warning), | ||
UnknownAtRules: new Rule('unknownAtRules', localize('rule.unknownAtRules', "Unknown at-rule."), Warning), | ||
IEStarHack: new Rule('ieHack', localize('rule.ieHack', "IE hacks are only necessary when supporting IE7 and older"), Ignore), | ||
@@ -37,0 +38,0 @@ UnknownVendorSpecificProperty: new Rule('unknownVendorSpecificProperties', localize('rule.unknownVendorSpecificProperty', "Unknown vendor specific property."), Ignore), |
@@ -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) { | ||
var _a; | ||
(_a = result.items).push.apply(_a, SCSSCompletion.scssAtDirectives); | ||
return result; | ||
}; | ||
SCSSCompletion.prototype.getCompletionForTopLevel = function (result) { | ||
this.getCompletionForAtDirectives(result); | ||
_super.prototype.getCompletionForTopLevel.call(this, result); | ||
return result; | ||
}; | ||
SCSSCompletion.variableDefaults = { | ||
@@ -186,2 +197,69 @@ '$red': '1', | ||
]; | ||
SCSSCompletion.scssAtDirectives = [ | ||
{ | ||
label: "@extend", | ||
documentation: localize("scss.builtin.@extend", "Inherits the styles of another selector."), | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
label: "@at-root", | ||
documentation: localize("scss.builtin.@at-root", "Causes one or more rules to be emitted at the root of the document."), | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
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."), | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
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."), | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
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."), | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
label: "@if", | ||
documentation: localize("scss.builtin.@if", "Includes the body if the expression does not evaluate to `false` or `null`."), | ||
insertText: "@if ${1:expr} {\n\t$0\n}", | ||
insertTextFormat: InsertTextFormat.Snippet, | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
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, | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
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, | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
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, | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
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, | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
{ | ||
label: "@include", | ||
documentation: localize("scss.builtin.@include", "Includes the styles defined by another mixin into the current rule."), | ||
kind: CompletionItemKind.Keyword | ||
}, | ||
]; | ||
return SCSSCompletion; | ||
@@ -188,0 +266,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; |
@@ -26,3 +26,3 @@ /* -------------------------------------------------------------------------------------------- | ||
var candidate = value; | ||
return Is.defined(candidate) && Is.number(candidate.line) && Is.number(candidate.character); | ||
return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character); | ||
} | ||
@@ -54,3 +54,3 @@ Position.is = is; | ||
var candidate = value; | ||
return Is.defined(candidate) && Position.is(candidate.start) && Position.is(candidate.end); | ||
return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); | ||
} | ||
@@ -84,4 +84,168 @@ Range.is = is; | ||
/** | ||
* The diagnostic's serverity. | ||
* The Color namespace provides helper functions to work with | ||
* [Color](#Color) literals. | ||
*/ | ||
export var Color; | ||
(function (Color) { | ||
/** | ||
* Creates a new Color literal. | ||
*/ | ||
function create(red, green, blue, alpha) { | ||
return { | ||
red: red, | ||
green: green, | ||
blue: blue, | ||
alpha: alpha, | ||
}; | ||
} | ||
Color.create = create; | ||
/** | ||
* Checks whether the given literal conforms to the [Color](#Color) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Is.number(candidate.red) | ||
&& Is.number(candidate.green) | ||
&& Is.number(candidate.blue) | ||
&& Is.number(candidate.alpha); | ||
} | ||
Color.is = is; | ||
})(Color || (Color = {})); | ||
/** | ||
* The ColorInformation namespace provides helper functions to work with | ||
* [ColorInformation](#ColorInformation) literals. | ||
*/ | ||
export var ColorInformation; | ||
(function (ColorInformation) { | ||
/** | ||
* Creates a new ColorInformation literal. | ||
*/ | ||
function create(range, color) { | ||
return { | ||
range: range, | ||
color: color, | ||
}; | ||
} | ||
ColorInformation.create = create; | ||
/** | ||
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Range.is(candidate.range) && Color.is(candidate.color); | ||
} | ||
ColorInformation.is = is; | ||
})(ColorInformation || (ColorInformation = {})); | ||
/** | ||
* The Color namespace provides helper functions to work with | ||
* [ColorPresentation](#ColorPresentation) literals. | ||
*/ | ||
export var ColorPresentation; | ||
(function (ColorPresentation) { | ||
/** | ||
* Creates a new ColorInformation literal. | ||
*/ | ||
function create(label, textEdit, additionalTextEdits) { | ||
return { | ||
label: label, | ||
textEdit: textEdit, | ||
additionalTextEdits: additionalTextEdits, | ||
}; | ||
} | ||
ColorPresentation.create = create; | ||
/** | ||
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Is.string(candidate.label) | ||
&& (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) | ||
&& (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); | ||
} | ||
ColorPresentation.is = is; | ||
})(ColorPresentation || (ColorPresentation = {})); | ||
/** | ||
* Enum of known range kinds | ||
*/ | ||
export var FoldingRangeKind; | ||
(function (FoldingRangeKind) { | ||
/** | ||
* Folding range for a comment | ||
*/ | ||
FoldingRangeKind["Comment"] = "comment"; | ||
/** | ||
* Folding range for a imports or includes | ||
*/ | ||
FoldingRangeKind["Imports"] = "imports"; | ||
/** | ||
* Folding range for a region (e.g. `#region`) | ||
*/ | ||
FoldingRangeKind["Region"] = "region"; | ||
})(FoldingRangeKind || (FoldingRangeKind = {})); | ||
/** | ||
* The folding range namespace provides helper functions to work with | ||
* [FoldingRange](#FoldingRange) literals. | ||
*/ | ||
export var FoldingRange; | ||
(function (FoldingRange) { | ||
/** | ||
* Creates a new FoldingRange literal. | ||
*/ | ||
function create(startLine, endLine, startCharacter, endCharacter, kind) { | ||
var result = { | ||
startLine: startLine, | ||
endLine: endLine | ||
}; | ||
if (Is.defined(startCharacter)) { | ||
result.startCharacter = startCharacter; | ||
} | ||
if (Is.defined(endCharacter)) { | ||
result.endCharacter = endCharacter; | ||
} | ||
if (Is.defined(kind)) { | ||
result.kind = kind; | ||
} | ||
return result; | ||
} | ||
FoldingRange.create = create; | ||
/** | ||
* Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Is.number(candidate.startLine) && Is.number(candidate.startLine) | ||
&& (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter)) | ||
&& (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter)) | ||
&& (Is.undefined(candidate.kind) || Is.string(candidate.kind)); | ||
} | ||
FoldingRange.is = is; | ||
})(FoldingRange || (FoldingRange = {})); | ||
/** | ||
* The DiagnosticRelatedInformation namespace provides helper functions to work with | ||
* [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals. | ||
*/ | ||
export var DiagnosticRelatedInformation; | ||
(function (DiagnosticRelatedInformation) { | ||
/** | ||
* Creates a new DiagnosticRelatedInformation literal. | ||
*/ | ||
function create(location, message) { | ||
return { | ||
location: location, | ||
message: message | ||
}; | ||
} | ||
DiagnosticRelatedInformation.create = create; | ||
/** | ||
* Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); | ||
} | ||
DiagnosticRelatedInformation.is = is; | ||
})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); | ||
/** | ||
* The diagnostic's severity. | ||
*/ | ||
export var DiagnosticSeverity; | ||
@@ -115,3 +279,3 @@ (function (DiagnosticSeverity) { | ||
*/ | ||
function create(range, message, severity, code, source) { | ||
function create(range, message, severity, code, source, relatedInformation) { | ||
var result = { range: range, message: message }; | ||
@@ -127,2 +291,5 @@ if (Is.defined(severity)) { | ||
} | ||
if (Is.defined(relatedInformation)) { | ||
result.relatedInformation = relatedInformation; | ||
} | ||
return result; | ||
@@ -141,3 +308,4 @@ } | ||
&& (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) | ||
&& (Is.string(candidate.source) || Is.undefined(candidate.source)); | ||
&& (Is.string(candidate.source) || Is.undefined(candidate.source)) | ||
&& (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); | ||
} | ||
@@ -172,3 +340,3 @@ Diagnostic.is = is; | ||
var candidate = value; | ||
return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.title); | ||
return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); | ||
} | ||
@@ -209,2 +377,9 @@ Command.is = is; | ||
TextEdit.del = del; | ||
function is(value) { | ||
var candidate = value; | ||
return Is.objectLiteral(candidate) | ||
&& Is.string(candidate.newText) | ||
&& Range.is(candidate.range); | ||
} | ||
TextEdit.is = is; | ||
})(TextEdit || (TextEdit = {})); | ||
@@ -232,2 +407,12 @@ /** | ||
})(TextDocumentEdit || (TextDocumentEdit = {})); | ||
export var WorkspaceEdit; | ||
(function (WorkspaceEdit) { | ||
function is(value) { | ||
var candidate = value; | ||
return candidate && | ||
(candidate.changes !== void 0 || candidate.documentChanges !== void 0) && | ||
(candidate.documentChanges === void 0 || Is.typedArray(candidate.documentChanges, TextDocumentEdit.is)); | ||
} | ||
WorkspaceEdit.is = is; | ||
})(WorkspaceEdit || (WorkspaceEdit = {})); | ||
var TextEditChangeImpl = /** @class */ (function () { | ||
@@ -428,2 +613,23 @@ function TextEditChangeImpl(edits) { | ||
})(MarkupKind || (MarkupKind = {})); | ||
(function (MarkupKind) { | ||
/** | ||
* Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown; | ||
} | ||
MarkupKind.is = is; | ||
})(MarkupKind || (MarkupKind = {})); | ||
export var MarkupContent; | ||
(function (MarkupContent) { | ||
/** | ||
* Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); | ||
} | ||
MarkupContent.is = is; | ||
})(MarkupContent || (MarkupContent = {})); | ||
/** | ||
@@ -525,3 +731,24 @@ * The kind of a completion entry. | ||
MarkedString.fromPlainText = fromPlainText; | ||
/** | ||
* Checks whether the given value conforms to the [MarkedString](#MarkedString) type. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value)); | ||
} | ||
MarkedString.is = is; | ||
})(MarkedString || (MarkedString = {})); | ||
export var Hover; | ||
(function (Hover) { | ||
/** | ||
* Checks whether the given value conforms to the [Hover](#Hover) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || | ||
MarkedString.is(candidate.contents) || | ||
Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range)); | ||
} | ||
Hover.is = is; | ||
})(Hover || (Hover = {})); | ||
/** | ||
@@ -576,3 +803,3 @@ * The ParameterInformation namespace provides helper functions to work with | ||
/** | ||
* A textual occurrance. | ||
* A textual occurrence. | ||
*/ | ||
@@ -649,3 +876,3 @@ DocumentHighlightKind.Text = 1; | ||
* @param uri The resource of the location of symbol, defaults to the current document. | ||
* @param containerName The name of the symbol containg the symbol. | ||
* @param containerName The name of the symbol containing the symbol. | ||
*/ | ||
@@ -666,2 +893,112 @@ function create(name, kind, range, uri, containerName) { | ||
/** | ||
* Represents programming constructs like variables, classes, interfaces etc. | ||
* that appear in a document. Document symbols can be hierarchical and they | ||
* have two ranges: one that encloses its definition and one that points to | ||
* its most interesting range, e.g. the range of an identifier. | ||
*/ | ||
var DocumentSymbol = /** @class */ (function () { | ||
function DocumentSymbol() { | ||
} | ||
return DocumentSymbol; | ||
}()); | ||
export { DocumentSymbol }; | ||
(function (DocumentSymbol) { | ||
/** | ||
* Creates a new symbol information literal. | ||
* | ||
* @param name The name of the symbol. | ||
* @param detail The detail of the symbol. | ||
* @param kind The kind of the symbol. | ||
* @param range The range of the symbol. | ||
* @param selectionRange The selectionRange of the symbol. | ||
* @param children Children of the symbol. | ||
*/ | ||
function create(name, detail, kind, range, selectionRange, children) { | ||
var result = { | ||
name: name, | ||
detail: detail, | ||
kind: kind, | ||
range: range, | ||
selectionRange: selectionRange | ||
}; | ||
if (children !== void 0) { | ||
result.children = children; | ||
} | ||
return result; | ||
} | ||
DocumentSymbol.create = create; | ||
/** | ||
* Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface. | ||
*/ | ||
function is(value) { | ||
var candidate = value; | ||
return candidate && | ||
Is.string(candidate.name) && Is.string(candidate.detail) && Is.number(candidate.kind) && | ||
Range.is(candidate.range) && Range.is(candidate.selectionRange) && | ||
(candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && | ||
(candidate.children === void 0 || Array.isArray(candidate.children)); | ||
} | ||
DocumentSymbol.is = is; | ||
})(DocumentSymbol || (DocumentSymbol = {})); | ||
/** | ||
* A set of predefined code action kinds | ||
*/ | ||
export var CodeActionKind; | ||
(function (CodeActionKind) { | ||
/** | ||
* Base kind for quickfix actions: 'quickfix' | ||
*/ | ||
CodeActionKind.QuickFix = 'quickfix'; | ||
/** | ||
* Base kind for refactoring actions: 'refactor' | ||
*/ | ||
CodeActionKind.Refactor = 'refactor'; | ||
/** | ||
* Base kind for refactoring extraction actions: 'refactor.extract' | ||
* | ||
* Example extract actions: | ||
* | ||
* - Extract method | ||
* - Extract function | ||
* - Extract variable | ||
* - Extract interface from class | ||
* - ... | ||
*/ | ||
CodeActionKind.RefactorExtract = 'refactor.extract'; | ||
/** | ||
* Base kind for refactoring inline actions: 'refactor.inline' | ||
* | ||
* Example inline actions: | ||
* | ||
* - Inline function | ||
* - Inline variable | ||
* - Inline constant | ||
* - ... | ||
*/ | ||
CodeActionKind.RefactorInline = 'refactor.inline'; | ||
/** | ||
* Base kind for refactoring rewrite actions: 'refactor.rewrite' | ||
* | ||
* Example rewrite actions: | ||
* | ||
* - Convert JavaScript function to class | ||
* - Add or remove parameter | ||
* - Encapsulate field | ||
* - Make method static | ||
* - Move method to base class | ||
* - ... | ||
*/ | ||
CodeActionKind.RefactorRewrite = 'refactor.rewrite'; | ||
/** | ||
* Base kind for source actions: `source` | ||
* | ||
* Source code actions apply to the entire file. | ||
*/ | ||
CodeActionKind.Source = 'source'; | ||
/** | ||
* Base kind for an organize imports source action: `source.organizeImports` | ||
*/ | ||
CodeActionKind.SourceOrganizeImports = 'source.organizeImports'; | ||
})(CodeActionKind || (CodeActionKind = {})); | ||
/** | ||
* The CodeActionContext namespace provides helper functions to work with | ||
@@ -675,4 +1012,8 @@ * [CodeActionContext](#CodeActionContext) literals. | ||
*/ | ||
function create(diagnostics) { | ||
return { diagnostics: diagnostics }; | ||
function create(diagnostics, only) { | ||
var result = { diagnostics: diagnostics }; | ||
if (only !== void 0 && only !== null) { | ||
result.only = only; | ||
} | ||
return result; | ||
} | ||
@@ -685,6 +1026,33 @@ CodeActionContext.create = create; | ||
var candidate = value; | ||
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is); | ||
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)); | ||
} | ||
CodeActionContext.is = is; | ||
})(CodeActionContext || (CodeActionContext = {})); | ||
export var CodeAction; | ||
(function (CodeAction) { | ||
function create(title, commandOrEdit, kind) { | ||
var result = { title: title }; | ||
if (Command.is(commandOrEdit)) { | ||
result.command = commandOrEdit; | ||
} | ||
else { | ||
result.edit = commandOrEdit; | ||
} | ||
if (kind !== void null) { | ||
result.kind = kind; | ||
} | ||
return result; | ||
} | ||
CodeAction.create = create; | ||
function is(value) { | ||
var candidate = value; | ||
return candidate && Is.string(candidate.title) && | ||
(candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && | ||
(candidate.kind === void 0 || Is.string(candidate.kind)) && | ||
(candidate.edit !== void 0 || candidate.command !== void 0) && | ||
(candidate.command === void 0 || Command.is(candidate.command)) && | ||
(candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); | ||
} | ||
CodeAction.is = is; | ||
})(CodeAction || (CodeAction = {})); | ||
/** | ||
@@ -755,4 +1123,4 @@ * The CodeLens namespace provides helper functions to work with | ||
*/ | ||
function create(range, target) { | ||
return { range: range, target: target }; | ||
function create(range, target, data) { | ||
return { range: range, target: target, data: data }; | ||
} | ||
@@ -798,3 +1166,3 @@ DocumentLink.create = create; | ||
} | ||
return 0; | ||
return diff; | ||
}); | ||
@@ -1003,2 +1371,9 @@ var lastModifiedOffset = text.length; | ||
Is.func = func; | ||
function objectLiteral(value) { | ||
// Strictly speaking class instances pass this check as well. Since the LSP | ||
// doesn't use classes we ignore this for now. If we do we need to add something | ||
// like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null` | ||
return value !== null && typeof value === 'object'; | ||
} | ||
Is.objectLiteral = objectLiteral; | ||
function typedArray(value, check) { | ||
@@ -1005,0 +1380,0 @@ return Array.isArray(value) && value.every(check); |
@@ -26,3 +26,4 @@ /*--------------------------------------------------------------------------------------------- | ||
monaco.languages.registerColorProvider(languageId, new languageFeatures.DocumentColorAdapter(worker)); | ||
monaco.languages.registerFoldingRangeProvider(languageId, new languageFeatures.FoldingRangeAdapter(worker)); | ||
new languageFeatures.DiagnosticsAdapter(languageId, worker, defaults); | ||
} |
@@ -93,2 +93,7 @@ /*--------------------------------------------------------------------------------------------- | ||
}; | ||
CSSWorker.prototype.provideFoldingRanges = function (uri, context) { | ||
var document = this._getTextDocument(uri); | ||
var ranges = this._languageService.getFoldingRanges(document, context); | ||
return Promise.as(ranges); | ||
}; | ||
CSSWorker.prototype.doRename = function (uri, position, newName) { | ||
@@ -95,0 +100,0 @@ var document = this._getTextDocument(uri); |
@@ -407,5 +407,7 @@ /*--------------------------------------------------------------------------------------------- | ||
name: item.name, | ||
detail: '', | ||
containerName: item.containerName, | ||
kind: toSymbolKind(item.kind), | ||
location: toLocation(item.location) | ||
range: toRange(item.location.range), | ||
selectionRange: toRange(item.location.range) | ||
}); }); | ||
@@ -456,2 +458,35 @@ })); | ||
export { DocumentColorAdapter }; | ||
var FoldingRangeAdapter = /** @class */ (function () { | ||
function FoldingRangeAdapter(_worker) { | ||
this._worker = _worker; | ||
} | ||
FoldingRangeAdapter.prototype.provideFoldingRanges = function (model, context, token) { | ||
var resource = model.uri; | ||
return wireCancellationToken(token, this._worker(resource).then(function (worker) { return worker.provideFoldingRanges(resource.toString(), context); }).then(function (ranges) { | ||
if (!ranges) { | ||
return; | ||
} | ||
return ranges.map(function (range) { | ||
var result = { | ||
start: range.startLine + 1, | ||
end: range.endLine + 1 | ||
}; | ||
if (typeof range.kind !== 'undefined') { | ||
result.kind = toFoldingRangeKind(range.kind); | ||
} | ||
return result; | ||
}); | ||
})); | ||
}; | ||
return FoldingRangeAdapter; | ||
}()); | ||
export { FoldingRangeAdapter }; | ||
function toFoldingRangeKind(kind) { | ||
switch (kind) { | ||
case ls.FoldingRangeKind.Comment: return monaco.languages.FoldingRangeKind.Comment; | ||
case ls.FoldingRangeKind.Imports: return monaco.languages.FoldingRangeKind.Imports; | ||
case ls.FoldingRangeKind.Region: return monaco.languages.FoldingRangeKind.Region; | ||
} | ||
return void 0; | ||
} | ||
/** | ||
@@ -458,0 +493,0 @@ * Hook a cancellation token to a WinJS Promise |
/*!----------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* monaco-css version: 2.1.1(a021ab7a38731f54509ae2a95507f8165728cd2f) | ||
* monaco-css version: 2.2.0(ce1fb4aab797eaa8f5071c77302f7bb72bcb22ea) | ||
* Released under the MIT license | ||
* https://github.com/Microsoft/monaco-css/blob/master/LICENSE.md | ||
*-----------------------------------------------------------------------------*/ | ||
define("vs/language/css/workerManager",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=monaco.Promise,n=function(){function e(e){var t=this;this._defaults=e,this._worker=null,this._idleCheckInterval=setInterval(function(){return t._checkIfIdle()},3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(function(){return t._stopWorker()})}return e.prototype._stopWorker=function(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null},e.prototype.dispose=function(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()},e.prototype._checkIfIdle=function(){this._worker&&(12e4<Date.now()-this._lastUsedTime&&this._stopWorker())},e.prototype._getClient=function(){return this._lastUsedTime=Date.now(),this._client||(this._worker=monaco.editor.createWebWorker({moduleId:"vs/language/css/cssWorker",label:this._defaults.languageId,createData:{languageSettings:this._defaults.diagnosticsOptions,languageId:this._defaults.languageId}}),this._client=this._worker.getProxy()),this._client},e.prototype.getLanguageServiceWorker=function(){for(var t,e,n,r,i,o=this,a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];return e=this._getClient().then(function(e){t=e}).then(function(e){return o._worker.withSyncedResources(a)}).then(function(e){return t}),i=new s(function(e,t){n=e,r=t},function(){}),e.then(n,r),i},e}();t.WorkerManager=n}),function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define("vscode-languageserver-types/main",["require","exports"],e)}(function(e,t){"use strict";var a,n,r,i,o,u,s,c,d,l,f,g,m;Object.defineProperty(t,"__esModule",{value:!0}),(n=a=t.Position||(t.Position={})).create=function(e,t){return{line:e,character:t}},n.is=function(e){var t=e;return P.defined(t)&&P.number(t.line)&&P.number(t.character)},(i=r=t.Range||(t.Range={})).create=function(e,t,n,r){if(P.number(e)&&P.number(t)&&P.number(n)&&P.number(r))return{start:a.create(e,t),end:a.create(n,r)};if(a.is(e)&&a.is(t))return{start:e,end:t};throw new Error("Range#create called with invalid arguments["+e+", "+t+", "+n+", "+r+"]")},i.is=function(e){var t=e;return P.defined(t)&&a.is(t.start)&&a.is(t.end)},(o=t.Location||(t.Location={})).create=function(e,t){return{uri:e,range:t}},o.is=function(e){var t=e;return P.defined(t)&&r.is(t.range)&&(P.string(t.uri)||P.undefined(t.uri))},(u=t.DiagnosticSeverity||(t.DiagnosticSeverity={})).Error=1,u.Warning=2,u.Information=3,u.Hint=4,(c=s=t.Diagnostic||(t.Diagnostic={})).create=function(e,t,n,r,i){var o={range:e,message:t};return P.defined(n)&&(o.severity=n),P.defined(r)&&(o.code=r),P.defined(i)&&(o.source=i),o},c.is=function(e){var t=e;return P.defined(t)&&r.is(t.range)&&P.string(t.message)&&(P.number(t.severity)||P.undefined(t.severity))&&(P.number(t.code)||P.string(t.code)||P.undefined(t.code))&&(P.string(t.source)||P.undefined(t.source))},(l=d=t.Command||(t.Command={})).create=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i={title:e,command:t};return P.defined(n)&&0<n.length&&(i.arguments=n),i},l.is=function(e){var t=e;return P.defined(t)&&P.string(t.title)&&P.string(t.title)},(g=f=t.TextEdit||(t.TextEdit={})).replace=function(e,t){return{range:e,newText:t}},g.insert=function(e,t){return{range:{start:e,end:e},newText:t}},g.del=function(e){return{range:e,newText:""}},(m=t.TextDocumentEdit||(t.TextDocumentEdit={})).create=function(e,t){return{textDocument:e,edits:t}},m.is=function(e){var t=e;return P.defined(t)&&p.is(t.textDocument)&&Array.isArray(t.edits)};var h,p,v,y,b,_,C,x,k,w,I,S,D=function(){function e(e){this.edits=e}return e.prototype.insert=function(e,t){this.edits.push(f.insert(e,t))},e.prototype.replace=function(e,t){this.edits.push(f.replace(e,t))},e.prototype.delete=function(e){this.edits.push(f.del(e))},e.prototype.add=function(e){this.edits.push(e)},e.prototype.all=function(){return this.edits},e.prototype.clear=function(){this.edits.splice(0,this.edits.length)},e}(),T=function(){function e(n){var r=this;this._textEditChanges=Object.create(null),n&&((this._workspaceEdit=n).documentChanges?n.documentChanges.forEach(function(e){var t=new D(e.edits);r._textEditChanges[e.textDocument.uri]=t}):n.changes&&Object.keys(n.changes).forEach(function(e){var t=new D(n.changes[e]);r._textEditChanges[e]=t}))}return Object.defineProperty(e.prototype,"edit",{get:function(){return this._workspaceEdit},enumerable:!0,configurable:!0}),e.prototype.getTextEditChange=function(e){if(p.is(e)){if(this._workspaceEdit||(this._workspaceEdit={documentChanges:[]}),!this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for versioned document changes.");var t=e;if(!(r=this._textEditChanges[t.uri])){var n={textDocument:t,edits:i=[]};this._workspaceEdit.documentChanges.push(n),r=new D(i),this._textEditChanges[t.uri]=r}return r}if(this._workspaceEdit||(this._workspaceEdit={changes:Object.create(null)}),!this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");var r;if(!(r=this._textEditChanges[e])){var i=[];this._workspaceEdit.changes[e]=i,r=new D(i),this._textEditChanges[e]=r}return r},e}();t.WorkspaceChange=T,(h=t.TextDocumentIdentifier||(t.TextDocumentIdentifier={})).create=function(e){return{uri:e}},h.is=function(e){var t=e;return P.defined(t)&&P.string(t.uri)},(v=p=t.VersionedTextDocumentIdentifier||(t.VersionedTextDocumentIdentifier={})).create=function(e,t){return{uri:e,version:t}},v.is=function(e){var t=e;return P.defined(t)&&P.string(t.uri)&&P.number(t.version)},(y=t.TextDocumentItem||(t.TextDocumentItem={})).create=function(e,t,n,r){return{uri:e,languageId:t,version:n,text:r}},y.is=function(e){var t=e;return P.defined(t)&&P.string(t.uri)&&P.string(t.languageId)&&P.number(t.version)&&P.string(t.text)},(b=t.MarkupKind||(t.MarkupKind={})).PlainText="plaintext",b.Markdown="markdown",(_=t.CompletionItemKind||(t.CompletionItemKind={})).Text=1,_.Method=2,_.Function=3,_.Constructor=4,_.Field=5,_.Variable=6,_.Class=7,_.Interface=8,_.Module=9,_.Property=10,_.Unit=11,_.Value=12,_.Enum=13,_.Keyword=14,_.Snippet=15,_.Color=16,_.File=17,_.Reference=18,_.Folder=19,_.EnumMember=20,_.Constant=21,_.Struct=22,_.Event=23,_.Operator=24,_.TypeParameter=25,(C=t.InsertTextFormat||(t.InsertTextFormat={})).PlainText=1,C.Snippet=2,(t.CompletionItem||(t.CompletionItem={})).create=function(e){return{label:e}},(t.CompletionList||(t.CompletionList={})).create=function(e,t){return{items:e||[],isIncomplete:!!t}},(t.MarkedString||(t.MarkedString={})).fromPlainText=function(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},(t.ParameterInformation||(t.ParameterInformation={})).create=function(e,t){return t?{label:e,documentation:t}:{label:e}},(t.SignatureInformation||(t.SignatureInformation={})).create=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i={label:e};return P.defined(t)&&(i.documentation=t),P.defined(n)?i.parameters=n:i.parameters=[],i},(x=t.DocumentHighlightKind||(t.DocumentHighlightKind={})).Text=1,x.Read=2,x.Write=3,(t.DocumentHighlight||(t.DocumentHighlight={})).create=function(e,t){var n={range:e};return P.number(t)&&(n.kind=t),n},(k=t.SymbolKind||(t.SymbolKind={})).File=1,k.Module=2,k.Namespace=3,k.Package=4,k.Class=5,k.Method=6,k.Property=7,k.Field=8,k.Constructor=9,k.Enum=10,k.Interface=11,k.Function=12,k.Variable=13,k.Constant=14,k.String=15,k.Number=16,k.Boolean=17,k.Array=18,k.Object=19,k.Key=20,k.Null=21,k.EnumMember=22,k.Struct=23,k.Event=24,k.Operator=25,k.TypeParameter=26,(t.SymbolInformation||(t.SymbolInformation={})).create=function(e,t,n,r,i){var o={name:e,kind:t,location:{uri:r,range:n}};return i&&(o.containerName=i),o},(w=t.CodeActionContext||(t.CodeActionContext={})).create=function(e){return{diagnostics:e}},w.is=function(e){var t=e;return P.defined(t)&&P.typedArray(t.diagnostics,s.is)},(I=t.CodeLens||(t.CodeLens={})).create=function(e,t){var n={range:e};return P.defined(t)&&(n.data=t),n},I.is=function(e){var t=e;return P.defined(t)&&r.is(t.range)&&(P.undefined(t.command)||d.is(t.command))},(S=t.FormattingOptions||(t.FormattingOptions={})).create=function(e,t){return{tabSize:e,insertSpaces:t}},S.is=function(e){var t=e;return P.defined(t)&&P.number(t.tabSize)&&P.boolean(t.insertSpaces)};var E,K,M,A=function(){};t.DocumentLink=A,(E=A=t.DocumentLink||(t.DocumentLink={})).create=function(e,t){return{range:e,target:t}},E.is=function(e){var t=e;return P.defined(t)&&r.is(t.range)&&(P.undefined(t.target)||P.string(t.target))},t.DocumentLink=A,t.EOL=["\n","\r\n","\r"],(K=t.TextDocument||(t.TextDocument={})).create=function(e,t,n,r){return new H(e,t,n,r)},K.is=function(e){var t=e;return!!(P.defined(t)&&P.string(t.uri)&&(P.undefined(t.languageId)||P.string(t.languageId))&&P.number(t.lineCount)&&P.func(t.getText)&&P.func(t.positionAt)&&P.func(t.offsetAt))},K.applyEdits=function(e,t){for(var n=e.getText(),r=function e(t,n){if(t.length<=1)return t;var r=t.length/2|0,i=t.slice(0,r),o=t.slice(r);e(i,n),e(o,n);for(var a=0,u=0,s=0;a<i.length&&u<o.length;){var c=n(i[a],o[u]);t[s++]=c<=0?i[a++]:o[u++]}for(;a<i.length;)t[s++]=i[a++];for(;u<o.length;)t[s++]=o[u++];return t}(t,function(e,t){return 0==e.range.start.line-t.range.start.line?e.range.start.character-t.range.start.character:0}),i=n.length,o=r.length-1;0<=o;o--){var a=r[o],u=e.offsetAt(a.range.start),s=e.offsetAt(a.range.end);if(!(s<=i))throw new Error("Ovelapping edit");n=n.substring(0,u)+a.newText+n.substring(s,n.length),i=u}return n},(M=t.TextDocumentSaveReason||(t.TextDocumentSaveReason={})).Manual=1,M.AfterDelay=2,M.FocusOut=3;var P,O,F,H=function(){function e(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=null}return Object.defineProperty(e.prototype,"uri",{get:function(){return this._uri},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"languageId",{get:function(){return this._languageId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!0,configurable:!0}),e.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content},e.prototype.update=function(e,t){this._content=e.text,this._version=t,this._lineOffsets=null},e.prototype.getLineOffsets=function(){if(null===this._lineOffsets){for(var e=[],t=this._content,n=!0,r=0;r<t.length;r++){n&&(e.push(r),n=!1);var i=t.charAt(r);n="\r"===i||"\n"===i,"\r"===i&&r+1<t.length&&"\n"===t.charAt(r+1)&&r++}n&&0<t.length&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets},e.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),n=0,r=t.length;if(0===r)return a.create(0,e);for(;n<r;){var i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}var o=n-1;return a.create(o,e-t[o])},e.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!0,configurable:!0}),e}();O=P||(P={}),F=Object.prototype.toString,O.defined=function(e){return void 0!==e},O.undefined=function(e){return void 0===e},O.boolean=function(e){return!0===e||!1===e},O.string=function(e){return"[object String]"===F.call(e)},O.number=function(e){return"[object Number]"===F.call(e)},O.func=function(e){return"[object Function]"===F.call(e)},O.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)}}),define("vscode-languageserver-types",["vscode-languageserver-types/main"],function(e){return e}),define("vs/language/css/languageFeatures",["require","exports","vscode-languageserver-types"],function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=monaco.Uri,n=function(){function e(e,t,n){var r=this;this._languageId=e,this._worker=t,this._disposables=[],this._listener=Object.create(null);var i=function(e){var t,n=e.getModeId();n===r._languageId&&(r._listener[e.uri.toString()]=e.onDidChangeContent(function(){clearTimeout(t),t=setTimeout(function(){return r._doValidate(e.uri,n)},500)}),r._doValidate(e.uri,n))},o=function(e){monaco.editor.setModelMarkers(e,r._languageId,[]);var t=e.uri.toString(),n=r._listener[t];n&&(n.dispose(),delete r._listener[t])};this._disposables.push(monaco.editor.onDidCreateModel(i)),this._disposables.push(monaco.editor.onWillDisposeModel(o)),this._disposables.push(monaco.editor.onDidChangeModelLanguage(function(e){o(e.model),i(e.model)})),n.onDidChange(function(e){monaco.editor.getModels().forEach(function(e){e.getModeId()===r._languageId&&(o(e),i(e))})}),this._disposables.push({dispose:function(){for(var e in r._listener)r._listener[e].dispose()}}),monaco.editor.getModels().forEach(i)}return e.prototype.dispose=function(){this._disposables.forEach(function(e){return e&&e.dispose()}),this._disposables=[]},e.prototype._doValidate=function(r,i){this._worker(r).then(function(e){return e.doValidation(r.toString())}).then(function(e){var t=e.map(function(e){return n="number"==typeof(t=e).code?String(t.code):t.code,{severity:function(e){switch(e){case o.DiagnosticSeverity.Error:return monaco.MarkerSeverity.Error;case o.DiagnosticSeverity.Warning:return monaco.MarkerSeverity.Warning;case o.DiagnosticSeverity.Information:return monaco.MarkerSeverity.Info;case o.DiagnosticSeverity.Hint:return monaco.MarkerSeverity.Hint;default:return monaco.MarkerSeverity.Info}}(t.severity),startLineNumber:t.range.start.line+1,startColumn:t.range.start.character+1,endLineNumber:t.range.end.line+1,endColumn:t.range.end.character+1,message:t.message,code:n,source:t.source};var t,n}),n=monaco.editor.getModel(r);n.getModeId()===i&&monaco.editor.setModelMarkers(n,i,t)}).done(void 0,function(e){console.error(e)})},e}();function a(e){if(e)return{character:e.column-1,line:e.lineNumber-1}}function s(e){if(e)return new monaco.Range(e.start.line+1,e.start.character+1,e.end.line+1,e.end.character+1)}function i(e){if(e)return{range:s(e.range),text:e.newText}}t.DiagnosticsAdapter=n;var r=function(){function e(e){this._worker=e}return Object.defineProperty(e.prototype,"triggerCharacters",{get:function(){return[" ",":"]},enumerable:!0,configurable:!0}),e.prototype.provideCompletionItems=function(e,t,n){e.getWordUntilPosition(t);var r=e.uri;return y(n,this._worker(r).then(function(e){return e.doComplete(r.toString(),a(t))}).then(function(e){if(e){var t=e.items.map(function(e){var t={label:e.label,insertText:e.insertText,sortText:e.sortText,filterText:e.filterText,documentation:e.documentation,detail:e.detail,kind:function(e){var t=monaco.languages.CompletionItemKind;switch(e){case o.CompletionItemKind.Text:return t.Text;case o.CompletionItemKind.Method:return t.Method;case o.CompletionItemKind.Function:return t.Function;case o.CompletionItemKind.Constructor:return t.Constructor;case o.CompletionItemKind.Field:return t.Field;case o.CompletionItemKind.Variable:return t.Variable;case o.CompletionItemKind.Class:return t.Class;case o.CompletionItemKind.Interface:return t.Interface;case o.CompletionItemKind.Module:return t.Module;case o.CompletionItemKind.Property:return t.Property;case o.CompletionItemKind.Unit:return t.Unit;case o.CompletionItemKind.Value:return t.Value;case o.CompletionItemKind.Enum:return t.Enum;case o.CompletionItemKind.Keyword:return t.Keyword;case o.CompletionItemKind.Snippet:return t.Snippet;case o.CompletionItemKind.Color:return t.Color;case o.CompletionItemKind.File:return t.File;case o.CompletionItemKind.Reference:return t.Reference}return t.Property}(e.kind)};return e.textEdit&&(t.range=s(e.textEdit.range),t.insertText=e.textEdit.newText),e.additionalTextEdits&&(t.additionalTextEdits=e.additionalTextEdits.map(i)),e.insertTextFormat===o.InsertTextFormat.Snippet&&(t.insertText={value:t.insertText}),t});return{isIncomplete:e.isIncomplete,items:t}}}))},e}();function c(e){return"string"==typeof e?{value:e}:(t=e)&&"object"==typeof t&&"string"==typeof t.kind?"plaintext"===e.kind?{value:e.value.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}:{value:e.value}:{value:"```"+e.language+"\n"+e.value+"\n```\n"};var t}t.CompletionAdapter=r;var d=function(){function e(e){this._worker=e}return e.prototype.provideHover=function(e,t,n){var r=e.uri;return y(n,this._worker(r).then(function(e){return e.doHover(r.toString(),a(t))}).then(function(e){if(e)return{range:s(e.range),contents:function(e){if(e)return Array.isArray(e)?e.map(c):[c(e)]}(e.contents)}}))},e}();t.HoverAdapter=d;var l=function(){function e(e){this._worker=e}return e.prototype.provideDocumentHighlights=function(e,t,n){var r=e.uri;return y(n,this._worker(r).then(function(e){return e.findDocumentHighlights(r.toString(),a(t))}).then(function(e){if(e)return e.map(function(e){return{range:s(e.range),kind:function(e){switch(e){case o.DocumentHighlightKind.Read:return monaco.languages.DocumentHighlightKind.Read;case o.DocumentHighlightKind.Write:return monaco.languages.DocumentHighlightKind.Write;case o.DocumentHighlightKind.Text:return monaco.languages.DocumentHighlightKind.Text}return monaco.languages.DocumentHighlightKind.Text}(e.kind)}})}))},e}();function f(e){return{uri:u.parse(e.uri),range:s(e.range)}}t.DocumentHighlightAdapter=l;var g=function(){function e(e){this._worker=e}return e.prototype.provideDefinition=function(e,t,n){var r=e.uri;return y(n,this._worker(r).then(function(e){return e.findDefinition(r.toString(),a(t))}).then(function(e){if(e)return[f(e)]}))},e}();t.DefinitionAdapter=g;var m=function(){function e(e){this._worker=e}return e.prototype.provideReferences=function(e,t,n,r){var i=e.uri;return y(r,this._worker(i).then(function(e){return e.findReferences(i.toString(),a(t))}).then(function(e){if(e)return e.map(f)}))},e}();t.ReferenceAdapter=m;var h=function(){function e(e){this._worker=e}return e.prototype.provideRenameEdits=function(e,t,n,r){var i=e.uri;return y(r,this._worker(i).then(function(e){return e.doRename(i.toString(),a(t),n)}).then(function(e){return function(e){if(e&&e.changes){var t=[];for(var n in e.changes){for(var r=[],i=0,o=e.changes[n];i<o.length;i++){var a=o[i];r.push({range:s(a.range),text:a.newText})}t.push({resource:u.parse(n),edits:r})}return{edits:t}}}(e)}))},e}();t.RenameAdapter=h;var p=function(){function e(e){this._worker=e}return e.prototype.provideDocumentSymbols=function(e,t){var n=e.uri;return y(t,this._worker(n).then(function(e){return e.findDocumentSymbols(n.toString())}).then(function(e){if(e)return e.map(function(e){return{name:e.name,containerName:e.containerName,kind:function(e){var t=monaco.languages.SymbolKind;switch(e){case o.SymbolKind.File:return t.Array;case o.SymbolKind.Module:return t.Module;case o.SymbolKind.Namespace:return t.Namespace;case o.SymbolKind.Package:return t.Package;case o.SymbolKind.Class:return t.Class;case o.SymbolKind.Method:return t.Method;case o.SymbolKind.Property:return t.Property;case o.SymbolKind.Field:return t.Field;case o.SymbolKind.Constructor:return t.Constructor;case o.SymbolKind.Enum:return t.Enum;case o.SymbolKind.Interface:return t.Interface;case o.SymbolKind.Function:return t.Function;case o.SymbolKind.Variable:return t.Variable;case o.SymbolKind.Constant:return t.Constant;case o.SymbolKind.String:return t.String;case o.SymbolKind.Number:return t.Number;case o.SymbolKind.Boolean:return t.Boolean;case o.SymbolKind.Array:return t.Array}return t.Function}(e.kind),location:f(e.location)}})}))},e}();t.DocumentSymbolAdapter=p;var v=function(){function e(e){this._worker=e}return e.prototype.provideDocumentColors=function(e,t){var n=e.uri;return y(t,this._worker(n).then(function(e){return e.findDocumentColors(n.toString())}).then(function(e){if(e)return e.map(function(e){return{color:e.color,range:s(e.range)}})}))},e.prototype.provideColorPresentations=function(e,t,n){var r=e.uri;return y(n,this._worker(r).then(function(e){return e.getColorPresentations(r.toString(),t.color,function(e){if(e)return{start:{line:e.startLineNumber-1,character:e.startColumn-1},end:{line:e.endLineNumber-1,character:e.endColumn-1}}}(t.range))}).then(function(e){if(e)return e.map(function(e){var t={label:e.label};return e.textEdit&&(t.textEdit=i(e.textEdit)),e.additionalTextEdits&&(t.additionalTextEdits=e.additionalTextEdits.map(i)),t})}))},e}();function y(e,t){return e.onCancellationRequested(function(){return t.cancel()}),t}t.DocumentColorAdapter=v}),define("vs/language/css/cssMode",["require","exports","./workerManager","./languageFeatures"],function(e,t,i,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setupMode=function(e){var r=new i.WorkerManager(e),t=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return r.getLanguageServiceWorker.apply(r,[e].concat(t))},n=e.languageId;monaco.languages.registerCompletionItemProvider(n,new o.CompletionAdapter(t)),monaco.languages.registerHoverProvider(n,new o.HoverAdapter(t)),monaco.languages.registerDocumentHighlightProvider(n,new o.DocumentHighlightAdapter(t)),monaco.languages.registerDefinitionProvider(n,new o.DefinitionAdapter(t)),monaco.languages.registerReferenceProvider(n,new o.ReferenceAdapter(t)),monaco.languages.registerDocumentSymbolProvider(n,new o.DocumentSymbolAdapter(t)),monaco.languages.registerRenameProvider(n,new o.RenameAdapter(t)),monaco.languages.registerColorProvider(n,new o.DocumentColorAdapter(t)),new o.DiagnosticsAdapter(n,t,e)}}); | ||
define("vs/language/css/workerManager",["require","exports"],function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var s=monaco.Promise,t=function(){function e(e){var n=this;this._defaults=e,this._worker=null,this._idleCheckInterval=setInterval(function(){return n._checkIfIdle()},3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(function(){return n._stopWorker()})}return e.prototype._stopWorker=function(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null},e.prototype.dispose=function(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()},e.prototype._checkIfIdle=function(){this._worker&&(12e4<Date.now()-this._lastUsedTime&&this._stopWorker())},e.prototype._getClient=function(){return this._lastUsedTime=Date.now(),this._client||(this._worker=monaco.editor.createWebWorker({moduleId:"vs/language/css/cssWorker",label:this._defaults.languageId,createData:{languageSettings:this._defaults.diagnosticsOptions,languageId:this._defaults.languageId}}),this._client=this._worker.getProxy()),this._client},e.prototype.getLanguageServiceWorker=function(){for(var n,e,t,r,i,o=this,a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];return e=this._getClient().then(function(e){n=e}).then(function(e){return o._worker.withSyncedResources(a)}).then(function(e){return n}),i=new s(function(e,n){t=e,r=n},function(){}),e.then(t,r),i},e}();n.WorkerManager=t}),function(e){if("object"==typeof module&&"object"==typeof module.exports){var n=e(require,exports);void 0!==n&&(module.exports=n)}else"function"==typeof define&&define.amd&&define("vscode-languageserver-types/main",["require","exports"],e)}(function(e,n){"use strict";var a,t,r,i,o,u,s,c,d,l,g,f,m,p,h,v,y,b,C,_,k,x,I,w;Object.defineProperty(n,"__esModule",{value:!0}),(t=a=n.Position||(n.Position={})).create=function(e,n){return{line:e,character:n}},t.is=function(e){var n=e;return Z.objectLiteral(n)&&Z.number(n.line)&&Z.number(n.character)},(i=r=n.Range||(n.Range={})).create=function(e,n,t,r){if(Z.number(e)&&Z.number(n)&&Z.number(t)&&Z.number(r))return{start:a.create(e,n),end:a.create(t,r)};if(a.is(e)&&a.is(n))return{start:e,end:n};throw new Error("Range#create called with invalid arguments["+e+", "+n+", "+t+", "+r+"]")},i.is=function(e){var n=e;return Z.objectLiteral(n)&&a.is(n.start)&&a.is(n.end)},(u=o=n.Location||(n.Location={})).create=function(e,n){return{uri:e,range:n}},u.is=function(e){var n=e;return Z.defined(n)&&r.is(n.range)&&(Z.string(n.uri)||Z.undefined(n.uri))},(c=s=n.Color||(n.Color={})).create=function(e,n,t,r){return{red:e,green:n,blue:t,alpha:r}},c.is=function(e){var n=e;return Z.number(n.red)&&Z.number(n.green)&&Z.number(n.blue)&&Z.number(n.alpha)},(d=n.ColorInformation||(n.ColorInformation={})).create=function(e,n){return{range:e,color:n}},d.is=function(e){var n=e;return r.is(n.range)&&s.is(n.color)},(l=n.ColorPresentation||(n.ColorPresentation={})).create=function(e,n,t){return{label:e,textEdit:n,additionalTextEdits:t}},l.is=function(e){var n=e;return Z.string(n.label)&&(Z.undefined(n.textEdit)||_.is(n))&&(Z.undefined(n.additionalTextEdits)||Z.typedArray(n.additionalTextEdits,_.is))},(g=n.FoldingRangeKind||(n.FoldingRangeKind={})).Comment="comment",g.Imports="imports",g.Region="region",(f=n.FoldingRange||(n.FoldingRange={})).create=function(e,n,t,r,i){var o={startLine:e,endLine:n};return Z.defined(t)&&(o.startCharacter=t),Z.defined(r)&&(o.endCharacter=r),Z.defined(i)&&(o.kind=i),o},f.is=function(e){var n=e;return Z.number(n.startLine)&&Z.number(n.startLine)&&(Z.undefined(n.startCharacter)||Z.number(n.startCharacter))&&(Z.undefined(n.endCharacter)||Z.number(n.endCharacter))&&(Z.undefined(n.kind)||Z.string(n.kind))},(p=m=n.DiagnosticRelatedInformation||(n.DiagnosticRelatedInformation={})).create=function(e,n){return{location:e,message:n}},p.is=function(e){var n=e;return Z.defined(n)&&o.is(n.location)&&Z.string(n.message)},(h=n.DiagnosticSeverity||(n.DiagnosticSeverity={})).Error=1,h.Warning=2,h.Information=3,h.Hint=4,(y=v=n.Diagnostic||(n.Diagnostic={})).create=function(e,n,t,r,i,o){var a={range:e,message:n};return Z.defined(t)&&(a.severity=t),Z.defined(r)&&(a.code=r),Z.defined(i)&&(a.source=i),Z.defined(o)&&(a.relatedInformation=o),a},y.is=function(e){var n=e;return Z.defined(n)&&r.is(n.range)&&Z.string(n.message)&&(Z.number(n.severity)||Z.undefined(n.severity))&&(Z.number(n.code)||Z.string(n.code)||Z.undefined(n.code))&&(Z.string(n.source)||Z.undefined(n.source))&&(Z.undefined(n.relatedInformation)||Z.typedArray(n.relatedInformation,m.is))},(C=b=n.Command||(n.Command={})).create=function(e,n){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var i={title:e,command:n};return Z.defined(t)&&0<t.length&&(i.arguments=t),i},C.is=function(e){var n=e;return Z.defined(n)&&Z.string(n.title)&&Z.string(n.command)},(k=_=n.TextEdit||(n.TextEdit={})).replace=function(e,n){return{range:e,newText:n}},k.insert=function(e,n){return{range:{start:e,end:e},newText:n}},k.del=function(e){return{range:e,newText:""}},k.is=function(e){var n=e;return Z.objectLiteral(n)&&Z.string(n.newText)&&r.is(n.range)},(I=x=n.TextDocumentEdit||(n.TextDocumentEdit={})).create=function(e,n){return{textDocument:e,edits:n}},I.is=function(e){var n=e;return Z.defined(n)&&D.is(n.textDocument)&&Array.isArray(n.edits)},(w=n.WorkspaceEdit||(n.WorkspaceEdit={})).is=function(e){var n=e;return n&&(void 0!==n.changes||void 0!==n.documentChanges)&&(void 0===n.documentChanges||Z.typedArray(n.documentChanges,x.is))};var S,D,K,E,T,M,A,R,P,F,L,O,j,H,W=function(){function e(e){this.edits=e}return e.prototype.insert=function(e,n){this.edits.push(_.insert(e,n))},e.prototype.replace=function(e,n){this.edits.push(_.replace(e,n))},e.prototype.delete=function(e){this.edits.push(_.del(e))},e.prototype.add=function(e){this.edits.push(e)},e.prototype.all=function(){return this.edits},e.prototype.clear=function(){this.edits.splice(0,this.edits.length)},e}(),N=function(){function e(t){var r=this;this._textEditChanges=Object.create(null),t&&((this._workspaceEdit=t).documentChanges?t.documentChanges.forEach(function(e){var n=new W(e.edits);r._textEditChanges[e.textDocument.uri]=n}):t.changes&&Object.keys(t.changes).forEach(function(e){var n=new W(t.changes[e]);r._textEditChanges[e]=n}))}return Object.defineProperty(e.prototype,"edit",{get:function(){return this._workspaceEdit},enumerable:!0,configurable:!0}),e.prototype.getTextEditChange=function(e){if(D.is(e)){if(this._workspaceEdit||(this._workspaceEdit={documentChanges:[]}),!this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for versioned document changes.");var n=e;if(!(r=this._textEditChanges[n.uri])){var t={textDocument:n,edits:i=[]};this._workspaceEdit.documentChanges.push(t),r=new W(i),this._textEditChanges[n.uri]=r}return r}if(this._workspaceEdit||(this._workspaceEdit={changes:Object.create(null)}),!this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");var r;if(!(r=this._textEditChanges[e])){var i=[];this._workspaceEdit.changes[e]=i,r=new W(i),this._textEditChanges[e]=r}return r},e}();n.WorkspaceChange=N,(S=n.TextDocumentIdentifier||(n.TextDocumentIdentifier={})).create=function(e){return{uri:e}},S.is=function(e){var n=e;return Z.defined(n)&&Z.string(n.uri)},(K=D=n.VersionedTextDocumentIdentifier||(n.VersionedTextDocumentIdentifier={})).create=function(e,n){return{uri:e,version:n}},K.is=function(e){var n=e;return Z.defined(n)&&Z.string(n.uri)&&Z.number(n.version)},(E=n.TextDocumentItem||(n.TextDocumentItem={})).create=function(e,n,t,r){return{uri:e,languageId:n,version:t,text:r}},E.is=function(e){var n=e;return Z.defined(n)&&Z.string(n.uri)&&Z.string(n.languageId)&&Z.number(n.version)&&Z.string(n.text)},(M=T=n.MarkupKind||(n.MarkupKind={})).PlainText="plaintext",M.Markdown="markdown",(A=T=n.MarkupKind||(n.MarkupKind={})).is=function(e){var n=e;return n===A.PlainText||n===A.Markdown},(R=n.MarkupContent||(n.MarkupContent={})).is=function(e){var n=e;return Z.objectLiteral(e)&&T.is(n.kind)&&Z.string(n.value)},(P=n.CompletionItemKind||(n.CompletionItemKind={})).Text=1,P.Method=2,P.Function=3,P.Constructor=4,P.Field=5,P.Variable=6,P.Class=7,P.Interface=8,P.Module=9,P.Property=10,P.Unit=11,P.Value=12,P.Enum=13,P.Keyword=14,P.Snippet=15,P.Color=16,P.File=17,P.Reference=18,P.Folder=19,P.EnumMember=20,P.Constant=21,P.Struct=22,P.Event=23,P.Operator=24,P.TypeParameter=25,(F=n.InsertTextFormat||(n.InsertTextFormat={})).PlainText=1,F.Snippet=2,(n.CompletionItem||(n.CompletionItem={})).create=function(e){return{label:e}},(n.CompletionList||(n.CompletionList={})).create=function(e,n){return{items:e||[],isIncomplete:!!n}},(O=L=n.MarkedString||(n.MarkedString={})).fromPlainText=function(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},O.is=function(e){var n=e;return Z.string(n)||Z.objectLiteral(n)&&Z.string(n.language)&&Z.string(n.value)},(n.Hover||(n.Hover={})).is=function(e){var n=e;return Z.objectLiteral(n)&&(R.is(n.contents)||L.is(n.contents)||Z.typedArray(n.contents,L.is))&&(void 0===e.range||r.is(e.range))},(n.ParameterInformation||(n.ParameterInformation={})).create=function(e,n){return n?{label:e,documentation:n}:{label:e}},(n.SignatureInformation||(n.SignatureInformation={})).create=function(e,n){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var i={label:e};return Z.defined(n)&&(i.documentation=n),Z.defined(t)?i.parameters=t:i.parameters=[],i},(j=n.DocumentHighlightKind||(n.DocumentHighlightKind={})).Text=1,j.Read=2,j.Write=3,(n.DocumentHighlight||(n.DocumentHighlight={})).create=function(e,n){var t={range:e};return Z.number(n)&&(t.kind=n),t},(H=n.SymbolKind||(n.SymbolKind={})).File=1,H.Module=2,H.Namespace=3,H.Package=4,H.Class=5,H.Method=6,H.Property=7,H.Field=8,H.Constructor=9,H.Enum=10,H.Interface=11,H.Function=12,H.Variable=13,H.Constant=14,H.String=15,H.Number=16,H.Boolean=17,H.Array=18,H.Object=19,H.Key=20,H.Null=21,H.EnumMember=22,H.Struct=23,H.Event=24,H.Operator=25,H.TypeParameter=26,(n.SymbolInformation||(n.SymbolInformation={})).create=function(e,n,t,r,i){var o={name:e,kind:n,location:{uri:r,range:t}};return i&&(o.containerName=i),o};var V,U,q,z,B,$,Q=function(){};n.DocumentSymbol=Q,(V=Q=n.DocumentSymbol||(n.DocumentSymbol={})).create=function(e,n,t,r,i,o){var a={name:e,detail:n,kind:t,range:r,selectionRange:i};return void 0!==o&&(a.children=o),a},V.is=function(e){var n=e;return n&&Z.string(n.name)&&Z.string(n.detail)&&Z.number(n.kind)&&r.is(n.range)&&r.is(n.selectionRange)&&(void 0===n.deprecated||Z.boolean(n.deprecated))&&(void 0===n.children||Array.isArray(n.children))},n.DocumentSymbol=Q,(U=n.CodeActionKind||(n.CodeActionKind={})).QuickFix="quickfix",U.Refactor="refactor",U.RefactorExtract="refactor.extract",U.RefactorInline="refactor.inline",U.RefactorRewrite="refactor.rewrite",U.Source="source",U.SourceOrganizeImports="source.organizeImports",(q=n.CodeActionContext||(n.CodeActionContext={})).create=function(e,n){var t={diagnostics:e};return null!=n&&(t.only=n),t},q.is=function(e){var n=e;return Z.defined(n)&&Z.typedArray(n.diagnostics,v.is)&&(void 0===n.only||Z.typedArray(n.only,Z.string))},(z=n.CodeAction||(n.CodeAction={})).create=function(e,n,t){var r={title:e};return b.is(n)?r.command=n:r.edit=n,void 0!==t&&(r.kind=t),r},z.is=function(e){var n=e;return n&&Z.string(n.title)&&(void 0===n.diagnostics||Z.typedArray(n.diagnostics,v.is))&&(void 0===n.kind||Z.string(n.kind))&&(void 0!==n.edit||void 0!==n.command)&&(void 0===n.command||b.is(n.command))&&(void 0===n.edit||w.is(n.edit))},(B=n.CodeLens||(n.CodeLens={})).create=function(e,n){var t={range:e};return Z.defined(n)&&(t.data=n),t},B.is=function(e){var n=e;return Z.defined(n)&&r.is(n.range)&&(Z.undefined(n.command)||b.is(n.command))},($=n.FormattingOptions||(n.FormattingOptions={})).create=function(e,n){return{tabSize:e,insertSpaces:n}},$.is=function(e){var n=e;return Z.defined(n)&&Z.number(n.tabSize)&&Z.boolean(n.insertSpaces)};var G,J,X,Y=function(){};n.DocumentLink=Y,(G=Y=n.DocumentLink||(n.DocumentLink={})).create=function(e,n,t){return{range:e,target:n,data:t}},G.is=function(e){var n=e;return Z.defined(n)&&r.is(n.range)&&(Z.undefined(n.target)||Z.string(n.target))},n.DocumentLink=Y,n.EOL=["\n","\r\n","\r"],(J=n.TextDocument||(n.TextDocument={})).create=function(e,n,t,r){return new te(e,n,t,r)},J.is=function(e){var n=e;return!!(Z.defined(n)&&Z.string(n.uri)&&(Z.undefined(n.languageId)||Z.string(n.languageId))&&Z.number(n.lineCount)&&Z.func(n.getText)&&Z.func(n.positionAt)&&Z.func(n.offsetAt))},J.applyEdits=function(e,n){for(var t=e.getText(),r=function e(n,t){if(n.length<=1)return n;var r=n.length/2|0,i=n.slice(0,r),o=n.slice(r);e(i,t),e(o,t);for(var a=0,u=0,s=0;a<i.length&&u<o.length;){var c=t(i[a],o[u]);n[s++]=c<=0?i[a++]:o[u++]}for(;a<i.length;)n[s++]=i[a++];for(;u<o.length;)n[s++]=o[u++];return n}(n,function(e,n){var t=e.range.start.line-n.range.start.line;return 0===t?e.range.start.character-n.range.start.character:t}),i=t.length,o=r.length-1;0<=o;o--){var a=r[o],u=e.offsetAt(a.range.start),s=e.offsetAt(a.range.end);if(!(s<=i))throw new Error("Ovelapping edit");t=t.substring(0,u)+a.newText+t.substring(s,t.length),i=u}return t},(X=n.TextDocumentSaveReason||(n.TextDocumentSaveReason={})).Manual=1,X.AfterDelay=2,X.FocusOut=3;var Z,ee,ne,te=function(){function e(e,n,t,r){this._uri=e,this._languageId=n,this._version=t,this._content=r,this._lineOffsets=null}return Object.defineProperty(e.prototype,"uri",{get:function(){return this._uri},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"languageId",{get:function(){return this._languageId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!0,configurable:!0}),e.prototype.getText=function(e){if(e){var n=this.offsetAt(e.start),t=this.offsetAt(e.end);return this._content.substring(n,t)}return this._content},e.prototype.update=function(e,n){this._content=e.text,this._version=n,this._lineOffsets=null},e.prototype.getLineOffsets=function(){if(null===this._lineOffsets){for(var e=[],n=this._content,t=!0,r=0;r<n.length;r++){t&&(e.push(r),t=!1);var i=n.charAt(r);t="\r"===i||"\n"===i,"\r"===i&&r+1<n.length&&"\n"===n.charAt(r+1)&&r++}t&&0<n.length&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets},e.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var n=this.getLineOffsets(),t=0,r=n.length;if(0===r)return a.create(0,e);for(;t<r;){var i=Math.floor((t+r)/2);n[i]>e?r=i:t=i+1}var o=t-1;return a.create(o,e-n[o])},e.prototype.offsetAt=function(e){var n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;var t=n[e.line],r=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(t+e.character,r),t)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!0,configurable:!0}),e}();ee=Z||(Z={}),ne=Object.prototype.toString,ee.defined=function(e){return void 0!==e},ee.undefined=function(e){return void 0===e},ee.boolean=function(e){return!0===e||!1===e},ee.string=function(e){return"[object String]"===ne.call(e)},ee.number=function(e){return"[object Number]"===ne.call(e)},ee.func=function(e){return"[object Function]"===ne.call(e)},ee.objectLiteral=function(e){return null!==e&&"object"==typeof e},ee.typedArray=function(e,n){return Array.isArray(e)&&e.every(n)}}),define("vscode-languageserver-types",["vscode-languageserver-types/main"],function(e){return e}),define("vs/language/css/languageFeatures",["require","exports","vscode-languageserver-types"],function(e,n,o){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var u=monaco.Uri,t=function(){function e(e,n,t){var r=this;this._languageId=e,this._worker=n,this._disposables=[],this._listener=Object.create(null);var i=function(e){var n,t=e.getModeId();t===r._languageId&&(r._listener[e.uri.toString()]=e.onDidChangeContent(function(){clearTimeout(n),n=setTimeout(function(){return r._doValidate(e.uri,t)},500)}),r._doValidate(e.uri,t))},o=function(e){monaco.editor.setModelMarkers(e,r._languageId,[]);var n=e.uri.toString(),t=r._listener[n];t&&(t.dispose(),delete r._listener[n])};this._disposables.push(monaco.editor.onDidCreateModel(i)),this._disposables.push(monaco.editor.onWillDisposeModel(o)),this._disposables.push(monaco.editor.onDidChangeModelLanguage(function(e){o(e.model),i(e.model)})),t.onDidChange(function(e){monaco.editor.getModels().forEach(function(e){e.getModeId()===r._languageId&&(o(e),i(e))})}),this._disposables.push({dispose:function(){for(var e in r._listener)r._listener[e].dispose()}}),monaco.editor.getModels().forEach(i)}return e.prototype.dispose=function(){this._disposables.forEach(function(e){return e&&e.dispose()}),this._disposables=[]},e.prototype._doValidate=function(r,i){this._worker(r).then(function(e){return e.doValidation(r.toString())}).then(function(e){var n=e.map(function(e){return t="number"==typeof(n=e).code?String(n.code):n.code,{severity:function(e){switch(e){case o.DiagnosticSeverity.Error:return monaco.MarkerSeverity.Error;case o.DiagnosticSeverity.Warning:return monaco.MarkerSeverity.Warning;case o.DiagnosticSeverity.Information:return monaco.MarkerSeverity.Info;case o.DiagnosticSeverity.Hint:return monaco.MarkerSeverity.Hint;default:return monaco.MarkerSeverity.Info}}(n.severity),startLineNumber:n.range.start.line+1,startColumn:n.range.start.character+1,endLineNumber:n.range.end.line+1,endColumn:n.range.end.character+1,message:n.message,code:t,source:n.source};var n,t}),t=monaco.editor.getModel(r);t.getModeId()===i&&monaco.editor.setModelMarkers(t,i,n)}).done(void 0,function(e){console.error(e)})},e}();function a(e){if(e)return{character:e.column-1,line:e.lineNumber-1}}function s(e){if(e)return new monaco.Range(e.start.line+1,e.start.character+1,e.end.line+1,e.end.character+1)}function i(e){if(e)return{range:s(e.range),text:e.newText}}n.DiagnosticsAdapter=t;var r=function(){function e(e){this._worker=e}return Object.defineProperty(e.prototype,"triggerCharacters",{get:function(){return[" ",":"]},enumerable:!0,configurable:!0}),e.prototype.provideCompletionItems=function(e,n,t){e.getWordUntilPosition(n);var r=e.uri;return b(t,this._worker(r).then(function(e){return e.doComplete(r.toString(),a(n))}).then(function(e){if(e){var n=e.items.map(function(e){var n={label:e.label,insertText:e.insertText,sortText:e.sortText,filterText:e.filterText,documentation:e.documentation,detail:e.detail,kind:function(e){var n=monaco.languages.CompletionItemKind;switch(e){case o.CompletionItemKind.Text:return n.Text;case o.CompletionItemKind.Method:return n.Method;case o.CompletionItemKind.Function:return n.Function;case o.CompletionItemKind.Constructor:return n.Constructor;case o.CompletionItemKind.Field:return n.Field;case o.CompletionItemKind.Variable:return n.Variable;case o.CompletionItemKind.Class:return n.Class;case o.CompletionItemKind.Interface:return n.Interface;case o.CompletionItemKind.Module:return n.Module;case o.CompletionItemKind.Property:return n.Property;case o.CompletionItemKind.Unit:return n.Unit;case o.CompletionItemKind.Value:return n.Value;case o.CompletionItemKind.Enum:return n.Enum;case o.CompletionItemKind.Keyword:return n.Keyword;case o.CompletionItemKind.Snippet:return n.Snippet;case o.CompletionItemKind.Color:return n.Color;case o.CompletionItemKind.File:return n.File;case o.CompletionItemKind.Reference:return n.Reference}return n.Property}(e.kind)};return e.textEdit&&(n.range=s(e.textEdit.range),n.insertText=e.textEdit.newText),e.additionalTextEdits&&(n.additionalTextEdits=e.additionalTextEdits.map(i)),e.insertTextFormat===o.InsertTextFormat.Snippet&&(n.insertText={value:n.insertText}),n});return{isIncomplete:e.isIncomplete,items:n}}}))},e}();function c(e){return"string"==typeof e?{value:e}:(n=e)&&"object"==typeof n&&"string"==typeof n.kind?"plaintext"===e.kind?{value:e.value.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}:{value:e.value}:{value:"```"+e.language+"\n"+e.value+"\n```\n"};var n}n.CompletionAdapter=r;var d=function(){function e(e){this._worker=e}return e.prototype.provideHover=function(e,n,t){var r=e.uri;return b(t,this._worker(r).then(function(e){return e.doHover(r.toString(),a(n))}).then(function(e){if(e)return{range:s(e.range),contents:function(e){if(e)return Array.isArray(e)?e.map(c):[c(e)]}(e.contents)}}))},e}();n.HoverAdapter=d;var l=function(){function e(e){this._worker=e}return e.prototype.provideDocumentHighlights=function(e,n,t){var r=e.uri;return b(t,this._worker(r).then(function(e){return e.findDocumentHighlights(r.toString(),a(n))}).then(function(e){if(e)return e.map(function(e){return{range:s(e.range),kind:function(e){switch(e){case o.DocumentHighlightKind.Read:return monaco.languages.DocumentHighlightKind.Read;case o.DocumentHighlightKind.Write:return monaco.languages.DocumentHighlightKind.Write;case o.DocumentHighlightKind.Text:return monaco.languages.DocumentHighlightKind.Text}return monaco.languages.DocumentHighlightKind.Text}(e.kind)}})}))},e}();function g(e){return{uri:u.parse(e.uri),range:s(e.range)}}n.DocumentHighlightAdapter=l;var f=function(){function e(e){this._worker=e}return e.prototype.provideDefinition=function(e,n,t){var r=e.uri;return b(t,this._worker(r).then(function(e){return e.findDefinition(r.toString(),a(n))}).then(function(e){if(e)return[g(e)]}))},e}();n.DefinitionAdapter=f;var m=function(){function e(e){this._worker=e}return e.prototype.provideReferences=function(e,n,t,r){var i=e.uri;return b(r,this._worker(i).then(function(e){return e.findReferences(i.toString(),a(n))}).then(function(e){if(e)return e.map(g)}))},e}();n.ReferenceAdapter=m;var p=function(){function e(e){this._worker=e}return e.prototype.provideRenameEdits=function(e,n,t,r){var i=e.uri;return b(r,this._worker(i).then(function(e){return e.doRename(i.toString(),a(n),t)}).then(function(e){return function(e){if(e&&e.changes){var n=[];for(var t in e.changes){for(var r=[],i=0,o=e.changes[t];i<o.length;i++){var a=o[i];r.push({range:s(a.range),text:a.newText})}n.push({resource:u.parse(t),edits:r})}return{edits:n}}}(e)}))},e}();n.RenameAdapter=p;var h=function(){function e(e){this._worker=e}return e.prototype.provideDocumentSymbols=function(e,n){var t=e.uri;return b(n,this._worker(t).then(function(e){return e.findDocumentSymbols(t.toString())}).then(function(e){if(e)return e.map(function(e){return{name:e.name,detail:"",containerName:e.containerName,kind:function(e){var n=monaco.languages.SymbolKind;switch(e){case o.SymbolKind.File:return n.Array;case o.SymbolKind.Module:return n.Module;case o.SymbolKind.Namespace:return n.Namespace;case o.SymbolKind.Package:return n.Package;case o.SymbolKind.Class:return n.Class;case o.SymbolKind.Method:return n.Method;case o.SymbolKind.Property:return n.Property;case o.SymbolKind.Field:return n.Field;case o.SymbolKind.Constructor:return n.Constructor;case o.SymbolKind.Enum:return n.Enum;case o.SymbolKind.Interface:return n.Interface;case o.SymbolKind.Function:return n.Function;case o.SymbolKind.Variable:return n.Variable;case o.SymbolKind.Constant:return n.Constant;case o.SymbolKind.String:return n.String;case o.SymbolKind.Number:return n.Number;case o.SymbolKind.Boolean:return n.Boolean;case o.SymbolKind.Array:return n.Array}return n.Function}(e.kind),range:s(e.location.range),selectionRange:s(e.location.range)}})}))},e}();n.DocumentSymbolAdapter=h;var v=function(){function e(e){this._worker=e}return e.prototype.provideDocumentColors=function(e,n){var t=e.uri;return b(n,this._worker(t).then(function(e){return e.findDocumentColors(t.toString())}).then(function(e){if(e)return e.map(function(e){return{color:e.color,range:s(e.range)}})}))},e.prototype.provideColorPresentations=function(e,n,t){var r=e.uri;return b(t,this._worker(r).then(function(e){return e.getColorPresentations(r.toString(),n.color,function(e){if(e)return{start:{line:e.startLineNumber-1,character:e.startColumn-1},end:{line:e.endLineNumber-1,character:e.endColumn-1}}}(n.range))}).then(function(e){if(e)return e.map(function(e){var n={label:e.label};return e.textEdit&&(n.textEdit=i(e.textEdit)),e.additionalTextEdits&&(n.additionalTextEdits=e.additionalTextEdits.map(i)),n})}))},e}();n.DocumentColorAdapter=v;var y=function(){function e(e){this._worker=e}return e.prototype.provideFoldingRanges=function(e,n,t){var r=e.uri;return b(t,this._worker(r).then(function(e){return e.provideFoldingRanges(r.toString(),n)}).then(function(e){if(e)return e.map(function(e){var n={start:e.startLine+1,end:e.endLine+1};return void 0!==e.kind&&(n.kind=function(e){switch(e){case o.FoldingRangeKind.Comment:return monaco.languages.FoldingRangeKind.Comment;case o.FoldingRangeKind.Imports:return monaco.languages.FoldingRangeKind.Imports;case o.FoldingRangeKind.Region:return monaco.languages.FoldingRangeKind.Region}return}(e.kind)),n})}))},e}();function b(e,n){return e.onCancellationRequested(function(){return n.cancel()}),n}n.FoldingRangeAdapter=y}),define("vs/language/css/cssMode",["require","exports","./workerManager","./languageFeatures"],function(e,n,i,o){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setupMode=function(e){var r=new i.WorkerManager(e),n=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return r.getLanguageServiceWorker.apply(r,[e].concat(n))},t=e.languageId;monaco.languages.registerCompletionItemProvider(t,new o.CompletionAdapter(n)),monaco.languages.registerHoverProvider(t,new o.HoverAdapter(n)),monaco.languages.registerDocumentHighlightProvider(t,new o.DocumentHighlightAdapter(n)),monaco.languages.registerDefinitionProvider(t,new o.DefinitionAdapter(n)),monaco.languages.registerReferenceProvider(t,new o.ReferenceAdapter(n)),monaco.languages.registerDocumentSymbolProvider(t,new o.DocumentSymbolAdapter(n)),monaco.languages.registerRenameProvider(t,new o.RenameAdapter(n)),monaco.languages.registerColorProvider(t,new o.DocumentColorAdapter(n)),monaco.languages.registerFoldingRangeProvider(t,new o.FoldingRangeAdapter(n)),new o.DiagnosticsAdapter(t,n,e)}}); |
/*!----------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* monaco-css version: 2.1.1(a021ab7a38731f54509ae2a95507f8165728cd2f) | ||
* monaco-css version: 2.2.0(ce1fb4aab797eaa8f5071c77302f7bb72bcb22ea) | ||
* Released under the MIT license | ||
@@ -5,0 +5,0 @@ * https://github.com/Microsoft/monaco-css/blob/master/LICENSE.md |
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
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2952427
45
52155