vscode-css-languageservice
Advanced tools
Comparing version 5.1.5 to 5.1.6
@@ -50,2 +50,6 @@ /*--------------------------------------------------------------------------------------------- | ||
}; | ||
export var cssWideFunctions = { | ||
'var()': 'Evaluates the value of a custom variable.', | ||
'calc()': 'Evaluates an mathematical expression. The following operators can be used: + - * /.' | ||
}; | ||
export var imageFunctions = { | ||
@@ -52,0 +56,0 @@ 'url()': 'Reference an image file by URL', |
@@ -6,2 +6,11 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { TokenType, Scanner } from './cssScanner'; | ||
@@ -37,3 +46,7 @@ import * as nodes from './cssNodes'; | ||
}; | ||
Parser.prototype.peekOne = function (types) { | ||
Parser.prototype.peekOne = function () { | ||
var types = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
types[_i] = arguments[_i]; | ||
} | ||
return types.indexOf(this.token.type) !== -1; | ||
@@ -447,9 +460,11 @@ }; | ||
} | ||
// try tp parse as expression | ||
// try to parse as expression | ||
var expression = this._parseExpr(); | ||
if (expression && !expression.isErroneous(true)) { | ||
this._parsePrio(); | ||
if (this.peekOne(stopTokens || [TokenType.SemiColon])) { | ||
if (this.peekOne.apply(this, __spreadArray(__spreadArray([], (stopTokens || []), false), [TokenType.SemiColon, TokenType.EOF], false))) { | ||
node.setValue(expression); | ||
node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist | ||
if (this.peek(TokenType.SemiColon)) { | ||
node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist | ||
} | ||
return this.finish(node); | ||
@@ -456,0 +471,0 @@ } |
@@ -509,4 +509,4 @@ /*--------------------------------------------------------------------------------------------- | ||
var hasMinus = this._minus(result); | ||
if (hasMinus && this._minus(result) /* -- */) { | ||
if (this._identFirstChar(result) || this._escape(result)) { | ||
if (hasMinus) { | ||
if (this._minus(result) /* -- */ || this._identFirstChar(result) || this._escape(result)) { | ||
while (this._identChar(result) || this._escape(result)) { | ||
@@ -513,0 +513,0 @@ // loop |
@@ -52,2 +52,6 @@ /*--------------------------------------------------------------------------------------------- | ||
var SnippetFormat = InsertTextFormat.Snippet; | ||
var retriggerCommand = { | ||
title: 'Suggest', | ||
command: 'editor.action.triggerSuggest' | ||
}; | ||
var SortTexts; | ||
@@ -286,6 +290,3 @@ (function (SortTexts) { | ||
if (triggerPropertyValueCompletion && retrigger) { | ||
item.command = { | ||
title: 'Suggest', | ||
command: 'editor.action.triggerSuggest' | ||
}; | ||
item.command = retriggerCommand; | ||
} | ||
@@ -438,2 +439,13 @@ var relevance = typeof entry.relevance === 'number' ? Math.min(Math.max(entry.relevance, 0), 99) : 50; | ||
} | ||
for (var func in languageFacts.cssWideFunctions) { | ||
var insertText = moveCursorInsideParenthesis(func); | ||
result.items.push({ | ||
label: func, | ||
documentation: languageFacts.cssWideFunctions[func], | ||
textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), | ||
kind: CompletionItemKind.Function, | ||
insertTextFormat: SnippetFormat, | ||
command: strings.startsWith(func, 'var') ? retriggerCommand : undefined | ||
}); | ||
} | ||
return result; | ||
@@ -440,0 +452,0 @@ }; |
@@ -16,3 +16,3 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pageBoxDirectives = exports.svgElements = exports.html5Tags = exports.units = exports.basicShapeFunctions = exports.transitionTimingFunctions = exports.imageFunctions = exports.cssWideKeywords = exports.geometryBoxKeywords = exports.boxKeywords = exports.lineWidthKeywords = exports.lineStyleKeywords = exports.repeatStyleKeywords = exports.positionKeywords = void 0; | ||
exports.pageBoxDirectives = exports.svgElements = exports.html5Tags = exports.units = exports.basicShapeFunctions = exports.transitionTimingFunctions = exports.imageFunctions = exports.cssWideFunctions = exports.cssWideKeywords = exports.geometryBoxKeywords = exports.boxKeywords = exports.lineWidthKeywords = exports.lineStyleKeywords = exports.repeatStyleKeywords = exports.positionKeywords = void 0; | ||
exports.positionKeywords = { | ||
@@ -62,2 +62,6 @@ 'bottom': 'Computes to ‘100%’ for the vertical position if one or two values are given, otherwise specifies the bottom edge as the origin for the next offset.', | ||
}; | ||
exports.cssWideFunctions = { | ||
'var()': 'Evaluates the value of a custom variable.', | ||
'calc()': 'Evaluates an mathematical expression. The following operators can be used: + - * /.' | ||
}; | ||
exports.imageFunctions = { | ||
@@ -64,0 +68,0 @@ 'url()': 'Reference an image file by URL', |
@@ -520,4 +520,4 @@ (function (factory) { | ||
var hasMinus = this._minus(result); | ||
if (hasMinus && this._minus(result) /* -- */) { | ||
if (this._identFirstChar(result) || this._escape(result)) { | ||
if (hasMinus) { | ||
if (this._minus(result) /* -- */ || this._identFirstChar(result) || this._escape(result)) { | ||
while (this._identChar(result) || this._escape(result)) { | ||
@@ -524,0 +524,0 @@ // loop |
@@ -63,2 +63,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var SnippetFormat = cssLanguageTypes_1.InsertTextFormat.Snippet; | ||
var retriggerCommand = { | ||
title: 'Suggest', | ||
command: 'editor.action.triggerSuggest' | ||
}; | ||
var SortTexts; | ||
@@ -297,6 +301,3 @@ (function (SortTexts) { | ||
if (triggerPropertyValueCompletion && retrigger) { | ||
item.command = { | ||
title: 'Suggest', | ||
command: 'editor.action.triggerSuggest' | ||
}; | ||
item.command = retriggerCommand; | ||
} | ||
@@ -449,2 +450,13 @@ var relevance = typeof entry.relevance === 'number' ? Math.min(Math.max(entry.relevance, 0), 99) : 50; | ||
} | ||
for (var func in languageFacts.cssWideFunctions) { | ||
var insertText = moveCursorInsideParenthesis(func); | ||
result.items.push({ | ||
label: func, | ||
documentation: languageFacts.cssWideFunctions[func], | ||
textEdit: cssLanguageTypes_1.TextEdit.replace(this.getCompletionRange(existingNode), insertText), | ||
kind: cssLanguageTypes_1.CompletionItemKind.Function, | ||
insertTextFormat: SnippetFormat, | ||
command: strings.startsWith(func, 'var') ? retriggerCommand : undefined | ||
}); | ||
} | ||
return result; | ||
@@ -451,0 +463,0 @@ }; |
{ | ||
"name": "vscode-css-languageservice", | ||
"version": "5.1.5", | ||
"version": "5.1.6", | ||
"description": "Language service for CSS, LESS and SCSS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/umd/cssLanguageService.js", |
Sorry, the diff of this file is too big to display
2932576
68825