vscode-css-languageservice 6.1.1 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +4 -3
- package/lib/esm/beautify/beautify-css.js +1 -1
- package/lib/esm/cssLanguageService.d.ts +2 -1
- package/lib/esm/cssLanguageService.js +1 -0
- package/lib/esm/cssLanguageTypes.d.ts +2 -2
- package/lib/esm/data/webCustomData.js +3502 -310
- package/lib/esm/languageFacts/colors.js +6 -7
- package/lib/esm/parser/cssErrors.js +34 -35
- package/lib/esm/parser/cssNodes.js +4 -4
- package/lib/esm/parser/cssParser.js +16 -16
- package/lib/esm/parser/scssErrors.js +4 -5
- package/lib/esm/parser/scssParser.js +3 -0
- package/lib/esm/services/cssCodeActions.js +2 -3
- package/lib/esm/services/cssCompletion.js +13 -4
- package/lib/esm/services/cssNavigation.js +19 -7
- package/lib/esm/services/lessCompletion.js +58 -59
- package/lib/esm/services/lint.js +64 -18
- package/lib/esm/services/lintRules.js +21 -22
- package/lib/esm/services/scssCompletion.js +107 -107
- package/lib/esm/services/selectorPrinting.js +2 -3
- package/lib/umd/beautify/beautify-css.js +1 -1
- package/lib/umd/cssLanguageService.d.ts +2 -1
- package/lib/umd/cssLanguageService.js +1 -0
- package/lib/umd/cssLanguageTypes.d.ts +2 -2
- package/lib/umd/data/webCustomData.js +3502 -310
- package/lib/umd/languageFacts/colors.js +7 -8
- package/lib/umd/parser/cssErrors.js +35 -36
- package/lib/umd/parser/cssNodes.js +4 -4
- package/lib/umd/parser/cssParser.js +16 -16
- package/lib/umd/parser/scssErrors.js +5 -6
- package/lib/umd/parser/scssParser.js +3 -0
- package/lib/umd/services/cssCodeActions.js +3 -4
- package/lib/umd/services/cssCompletion.js +14 -5
- package/lib/umd/services/cssNavigation.js +20 -8
- package/lib/umd/services/lessCompletion.js +59 -60
- package/lib/umd/services/lint.js +65 -19
- package/lib/umd/services/lintRules.js +22 -23
- package/lib/umd/services/scssCompletion.js +108 -108
- package/lib/umd/services/selectorPrinting.js +3 -4
- package/package.json +13 -16
|
@@ -8,21 +8,20 @@
|
|
|
8
8
|
if (v !== undefined) module.exports = v;
|
|
9
9
|
}
|
|
10
10
|
else if (typeof define === "function" && define.amd) {
|
|
11
|
-
define(["require", "exports", "../parser/cssNodes", "vscode
|
|
11
|
+
define(["require", "exports", "../parser/cssNodes", "@vscode/l10n"], factory);
|
|
12
12
|
}
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.getColorValue = exports.hwbFromColor = exports.colorFromHWB = exports.hslFromColor = exports.colorFromHSL = exports.colorFrom256RGB = exports.colorFromHex = exports.hexDigit = exports.isColorValue = exports.isColorConstructor = exports.colorKeywords = exports.colors = exports.colorFunctions = void 0;
|
|
17
17
|
const nodes = require("../parser/cssNodes");
|
|
18
|
-
const
|
|
19
|
-
const localize = nls.loadMessageBundle();
|
|
18
|
+
const l10n = require("@vscode/l10n");
|
|
20
19
|
exports.colorFunctions = [
|
|
21
|
-
{ func: 'rgb($red, $green, $blue)', desc:
|
|
22
|
-
{ func: 'rgba($red, $green, $blue, $alpha)', desc:
|
|
23
|
-
{ func: 'hsl($hue, $saturation, $lightness)', desc:
|
|
24
|
-
{ func: 'hsla($hue, $saturation, $lightness, $alpha)', desc:
|
|
25
|
-
{ func: 'hwb($hue $white $black)', desc:
|
|
20
|
+
{ func: 'rgb($red, $green, $blue)', desc: l10n.t('Creates a Color from red, green, and blue values.') },
|
|
21
|
+
{ func: 'rgba($red, $green, $blue, $alpha)', desc: l10n.t('Creates a Color from red, green, blue, and alpha values.') },
|
|
22
|
+
{ func: 'hsl($hue, $saturation, $lightness)', desc: l10n.t('Creates a Color from hue, saturation, and lightness values.') },
|
|
23
|
+
{ func: 'hsla($hue, $saturation, $lightness, $alpha)', desc: l10n.t('Creates a Color from hue, saturation, lightness, and alpha values.') },
|
|
24
|
+
{ func: 'hwb($hue $white $black)', desc: l10n.t('Creates a Color from hue, white and black.') }
|
|
26
25
|
];
|
|
27
26
|
exports.colors = {
|
|
28
27
|
aliceblue: '#f0f8ff',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "vscode
|
|
7
|
+
define(["require", "exports", "@vscode/l10n"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
'use strict';
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.ParseError = exports.CSSIssueType = void 0;
|
|
17
|
-
const
|
|
18
|
-
const localize = nls.loadMessageBundle();
|
|
17
|
+
const l10n = require("@vscode/l10n");
|
|
19
18
|
class CSSIssueType {
|
|
20
19
|
constructor(id, message) {
|
|
21
20
|
this.id = id;
|
|
@@ -24,38 +23,38 @@
|
|
|
24
23
|
}
|
|
25
24
|
exports.CSSIssueType = CSSIssueType;
|
|
26
25
|
exports.ParseError = {
|
|
27
|
-
NumberExpected: new CSSIssueType('css-numberexpected',
|
|
28
|
-
ConditionExpected: new CSSIssueType('css-conditionexpected',
|
|
29
|
-
RuleOrSelectorExpected: new CSSIssueType('css-ruleorselectorexpected',
|
|
30
|
-
DotExpected: new CSSIssueType('css-dotexpected',
|
|
31
|
-
ColonExpected: new CSSIssueType('css-colonexpected',
|
|
32
|
-
SemiColonExpected: new CSSIssueType('css-semicolonexpected',
|
|
33
|
-
TermExpected: new CSSIssueType('css-termexpected',
|
|
34
|
-
ExpressionExpected: new CSSIssueType('css-expressionexpected',
|
|
35
|
-
OperatorExpected: new CSSIssueType('css-operatorexpected',
|
|
36
|
-
IdentifierExpected: new CSSIssueType('css-identifierexpected',
|
|
37
|
-
PercentageExpected: new CSSIssueType('css-percentageexpected',
|
|
38
|
-
URIOrStringExpected: new CSSIssueType('css-uriorstringexpected',
|
|
39
|
-
URIExpected: new CSSIssueType('css-uriexpected',
|
|
40
|
-
VariableNameExpected: new CSSIssueType('css-varnameexpected',
|
|
41
|
-
VariableValueExpected: new CSSIssueType('css-varvalueexpected',
|
|
42
|
-
PropertyValueExpected: new CSSIssueType('css-propertyvalueexpected',
|
|
43
|
-
LeftCurlyExpected: new CSSIssueType('css-lcurlyexpected',
|
|
44
|
-
RightCurlyExpected: new CSSIssueType('css-rcurlyexpected',
|
|
45
|
-
LeftSquareBracketExpected: new CSSIssueType('css-rbracketexpected',
|
|
46
|
-
RightSquareBracketExpected: new CSSIssueType('css-lbracketexpected',
|
|
47
|
-
LeftParenthesisExpected: new CSSIssueType('css-lparentexpected',
|
|
48
|
-
RightParenthesisExpected: new CSSIssueType('css-rparentexpected',
|
|
49
|
-
CommaExpected: new CSSIssueType('css-commaexpected',
|
|
50
|
-
PageDirectiveOrDeclarationExpected: new CSSIssueType('css-pagedirordeclexpected',
|
|
51
|
-
UnknownAtRule: new CSSIssueType('css-unknownatrule',
|
|
52
|
-
UnknownKeyword: new CSSIssueType('css-unknownkeyword',
|
|
53
|
-
SelectorExpected: new CSSIssueType('css-selectorexpected',
|
|
54
|
-
StringLiteralExpected: new CSSIssueType('css-stringliteralexpected',
|
|
55
|
-
WhitespaceExpected: new CSSIssueType('css-whitespaceexpected',
|
|
56
|
-
MediaQueryExpected: new CSSIssueType('css-mediaqueryexpected',
|
|
57
|
-
IdentifierOrWildcardExpected: new CSSIssueType('css-idorwildcardexpected',
|
|
58
|
-
WildcardExpected: new CSSIssueType('css-wildcardexpected',
|
|
59
|
-
IdentifierOrVariableExpected: new CSSIssueType('css-idorvarexpected',
|
|
26
|
+
NumberExpected: new CSSIssueType('css-numberexpected', l10n.t("number expected")),
|
|
27
|
+
ConditionExpected: new CSSIssueType('css-conditionexpected', l10n.t("condition expected")),
|
|
28
|
+
RuleOrSelectorExpected: new CSSIssueType('css-ruleorselectorexpected', l10n.t("at-rule or selector expected")),
|
|
29
|
+
DotExpected: new CSSIssueType('css-dotexpected', l10n.t("dot expected")),
|
|
30
|
+
ColonExpected: new CSSIssueType('css-colonexpected', l10n.t("colon expected")),
|
|
31
|
+
SemiColonExpected: new CSSIssueType('css-semicolonexpected', l10n.t("semi-colon expected")),
|
|
32
|
+
TermExpected: new CSSIssueType('css-termexpected', l10n.t("term expected")),
|
|
33
|
+
ExpressionExpected: new CSSIssueType('css-expressionexpected', l10n.t("expression expected")),
|
|
34
|
+
OperatorExpected: new CSSIssueType('css-operatorexpected', l10n.t("operator expected")),
|
|
35
|
+
IdentifierExpected: new CSSIssueType('css-identifierexpected', l10n.t("identifier expected")),
|
|
36
|
+
PercentageExpected: new CSSIssueType('css-percentageexpected', l10n.t("percentage expected")),
|
|
37
|
+
URIOrStringExpected: new CSSIssueType('css-uriorstringexpected', l10n.t("uri or string expected")),
|
|
38
|
+
URIExpected: new CSSIssueType('css-uriexpected', l10n.t("URI expected")),
|
|
39
|
+
VariableNameExpected: new CSSIssueType('css-varnameexpected', l10n.t("variable name expected")),
|
|
40
|
+
VariableValueExpected: new CSSIssueType('css-varvalueexpected', l10n.t("variable value expected")),
|
|
41
|
+
PropertyValueExpected: new CSSIssueType('css-propertyvalueexpected', l10n.t("property value expected")),
|
|
42
|
+
LeftCurlyExpected: new CSSIssueType('css-lcurlyexpected', l10n.t("{ expected")),
|
|
43
|
+
RightCurlyExpected: new CSSIssueType('css-rcurlyexpected', l10n.t("} expected")),
|
|
44
|
+
LeftSquareBracketExpected: new CSSIssueType('css-rbracketexpected', l10n.t("[ expected")),
|
|
45
|
+
RightSquareBracketExpected: new CSSIssueType('css-lbracketexpected', l10n.t("] expected")),
|
|
46
|
+
LeftParenthesisExpected: new CSSIssueType('css-lparentexpected', l10n.t("( expected")),
|
|
47
|
+
RightParenthesisExpected: new CSSIssueType('css-rparentexpected', l10n.t(") expected")),
|
|
48
|
+
CommaExpected: new CSSIssueType('css-commaexpected', l10n.t("comma expected")),
|
|
49
|
+
PageDirectiveOrDeclarationExpected: new CSSIssueType('css-pagedirordeclexpected', l10n.t("page directive or declaraton expected")),
|
|
50
|
+
UnknownAtRule: new CSSIssueType('css-unknownatrule', l10n.t("at-rule unknown")),
|
|
51
|
+
UnknownKeyword: new CSSIssueType('css-unknownkeyword', l10n.t("unknown keyword")),
|
|
52
|
+
SelectorExpected: new CSSIssueType('css-selectorexpected', l10n.t("selector expected")),
|
|
53
|
+
StringLiteralExpected: new CSSIssueType('css-stringliteralexpected', l10n.t("string literal expected")),
|
|
54
|
+
WhitespaceExpected: new CSSIssueType('css-whitespaceexpected', l10n.t("whitespace expected")),
|
|
55
|
+
MediaQueryExpected: new CSSIssueType('css-mediaqueryexpected', l10n.t("media query expected")),
|
|
56
|
+
IdentifierOrWildcardExpected: new CSSIssueType('css-idorwildcardexpected', l10n.t("identifier or wildcard expected")),
|
|
57
|
+
WildcardExpected: new CSSIssueType('css-wildcardexpected', l10n.t("wildcard expected")),
|
|
58
|
+
IdentifierOrVariableExpected: new CSSIssueType('css-idorvarexpected', l10n.t("identifier or variable expected")),
|
|
60
59
|
};
|
|
61
60
|
});
|
|
@@ -166,6 +166,7 @@
|
|
|
166
166
|
}
|
|
167
167
|
exports.getParentDeclaration = getParentDeclaration;
|
|
168
168
|
class Node {
|
|
169
|
+
get end() { return this.offset + this.length; }
|
|
169
170
|
constructor(offset = -1, len = -1, nodeType) {
|
|
170
171
|
this.parent = null;
|
|
171
172
|
this.offset = offset;
|
|
@@ -174,7 +175,6 @@
|
|
|
174
175
|
this.nodeType = nodeType;
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
|
-
get end() { return this.offset + this.length; }
|
|
178
178
|
set type(type) {
|
|
179
179
|
this.nodeType = type;
|
|
180
180
|
}
|
|
@@ -1600,14 +1600,14 @@
|
|
|
1600
1600
|
}
|
|
1601
1601
|
*/
|
|
1602
1602
|
class ParseErrorCollector {
|
|
1603
|
-
constructor() {
|
|
1604
|
-
this.entries = [];
|
|
1605
|
-
}
|
|
1606
1603
|
static entries(node) {
|
|
1607
1604
|
const visitor = new ParseErrorCollector();
|
|
1608
1605
|
node.acceptVisitor(visitor);
|
|
1609
1606
|
return visitor.entries;
|
|
1610
1607
|
}
|
|
1608
|
+
constructor() {
|
|
1609
|
+
this.entries = [];
|
|
1610
|
+
}
|
|
1611
1611
|
visitNode(node) {
|
|
1612
1612
|
if (node.isErroneous()) {
|
|
1613
1613
|
node.collectIssues(this.entries);
|
|
@@ -980,29 +980,17 @@
|
|
|
980
980
|
// <mf-plain> = <mf-name> : <mf-value>
|
|
981
981
|
// <mf-boolean> = <mf-name>
|
|
982
982
|
// <mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>
|
|
983
|
-
const parseRangeOperator = () => {
|
|
984
|
-
if (this.acceptDelim('<') || this.acceptDelim('>')) {
|
|
985
|
-
if (!this.hasWhitespace()) {
|
|
986
|
-
this.acceptDelim('=');
|
|
987
|
-
}
|
|
988
|
-
return true;
|
|
989
|
-
}
|
|
990
|
-
else if (this.acceptDelim('=')) {
|
|
991
|
-
return true;
|
|
992
|
-
}
|
|
993
|
-
return false;
|
|
994
|
-
};
|
|
995
983
|
if (node.addChild(this._parseMediaFeatureName())) {
|
|
996
984
|
if (this.accept(cssScanner_1.TokenType.Colon)) {
|
|
997
985
|
if (!node.addChild(this._parseMediaFeatureValue())) {
|
|
998
986
|
return this.finish(node, cssErrors_1.ParseError.TermExpected, [], resyncStopToken);
|
|
999
987
|
}
|
|
1000
988
|
}
|
|
1001
|
-
else if (
|
|
989
|
+
else if (this._parseMediaFeatureRangeOperator()) {
|
|
1002
990
|
if (!node.addChild(this._parseMediaFeatureValue())) {
|
|
1003
991
|
return this.finish(node, cssErrors_1.ParseError.TermExpected, [], resyncStopToken);
|
|
1004
992
|
}
|
|
1005
|
-
if (
|
|
993
|
+
if (this._parseMediaFeatureRangeOperator()) {
|
|
1006
994
|
if (!node.addChild(this._parseMediaFeatureValue())) {
|
|
1007
995
|
return this.finish(node, cssErrors_1.ParseError.TermExpected, [], resyncStopToken);
|
|
1008
996
|
}
|
|
@@ -1013,13 +1001,13 @@
|
|
|
1013
1001
|
}
|
|
1014
1002
|
}
|
|
1015
1003
|
else if (node.addChild(this._parseMediaFeatureValue())) {
|
|
1016
|
-
if (!
|
|
1004
|
+
if (!this._parseMediaFeatureRangeOperator()) {
|
|
1017
1005
|
return this.finish(node, cssErrors_1.ParseError.OperatorExpected, [], resyncStopToken);
|
|
1018
1006
|
}
|
|
1019
1007
|
if (!node.addChild(this._parseMediaFeatureName())) {
|
|
1020
1008
|
return this.finish(node, cssErrors_1.ParseError.IdentifierExpected, [], resyncStopToken);
|
|
1021
1009
|
}
|
|
1022
|
-
if (
|
|
1010
|
+
if (this._parseMediaFeatureRangeOperator()) {
|
|
1023
1011
|
if (!node.addChild(this._parseMediaFeatureValue())) {
|
|
1024
1012
|
return this.finish(node, cssErrors_1.ParseError.TermExpected, [], resyncStopToken);
|
|
1025
1013
|
}
|
|
@@ -1030,6 +1018,18 @@
|
|
|
1030
1018
|
}
|
|
1031
1019
|
return this.finish(node);
|
|
1032
1020
|
}
|
|
1021
|
+
_parseMediaFeatureRangeOperator() {
|
|
1022
|
+
if (this.acceptDelim('<') || this.acceptDelim('>')) {
|
|
1023
|
+
if (!this.hasWhitespace()) {
|
|
1024
|
+
this.acceptDelim('=');
|
|
1025
|
+
}
|
|
1026
|
+
return true;
|
|
1027
|
+
}
|
|
1028
|
+
else if (this.acceptDelim('=')) {
|
|
1029
|
+
return true;
|
|
1030
|
+
}
|
|
1031
|
+
return false;
|
|
1032
|
+
}
|
|
1033
1033
|
_parseMediaFeatureName() {
|
|
1034
1034
|
return this._parseIdent();
|
|
1035
1035
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "vscode
|
|
7
|
+
define(["require", "exports", "@vscode/l10n"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
'use strict';
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.SCSSParseError = exports.SCSSIssueType = void 0;
|
|
17
|
-
const
|
|
18
|
-
const localize = nls.loadMessageBundle();
|
|
17
|
+
const l10n = require("@vscode/l10n");
|
|
19
18
|
class SCSSIssueType {
|
|
20
19
|
constructor(id, message) {
|
|
21
20
|
this.id = id;
|
|
@@ -24,8 +23,8 @@
|
|
|
24
23
|
}
|
|
25
24
|
exports.SCSSIssueType = SCSSIssueType;
|
|
26
25
|
exports.SCSSParseError = {
|
|
27
|
-
FromExpected: new SCSSIssueType('scss-fromexpected',
|
|
28
|
-
ThroughOrToExpected: new SCSSIssueType('scss-throughexpected',
|
|
29
|
-
InExpected: new SCSSIssueType('scss-fromexpected',
|
|
26
|
+
FromExpected: new SCSSIssueType('scss-fromexpected', l10n.t("'from' expected")),
|
|
27
|
+
ThroughOrToExpected: new SCSSIssueType('scss-throughexpected', l10n.t("'through' or 'to' expected")),
|
|
28
|
+
InExpected: new SCSSIssueType('scss-fromexpected', l10n.t("'in' expected")),
|
|
30
29
|
};
|
|
31
30
|
});
|
|
@@ -100,6 +100,9 @@
|
|
|
100
100
|
_parseMediaCondition() {
|
|
101
101
|
return this._parseInterpolation() || super._parseMediaCondition();
|
|
102
102
|
}
|
|
103
|
+
_parseMediaFeatureRangeOperator() {
|
|
104
|
+
return this.accept(scssScanner.SmallerEqualsOperator) || this.accept(scssScanner.GreaterEqualsOperator) || super._parseMediaFeatureRangeOperator();
|
|
105
|
+
}
|
|
103
106
|
_parseMediaFeatureName() {
|
|
104
107
|
return this._parseModuleMember()
|
|
105
108
|
|| this._parseFunction() // function before ident
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "../parser/cssNodes", "../utils/strings", "../services/lintRules", "../cssLanguageTypes", "vscode
|
|
7
|
+
define(["require", "exports", "../parser/cssNodes", "../utils/strings", "../services/lintRules", "../cssLanguageTypes", "@vscode/l10n"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
const strings_1 = require("../utils/strings");
|
|
19
19
|
const lintRules_1 = require("../services/lintRules");
|
|
20
20
|
const cssLanguageTypes_1 = require("../cssLanguageTypes");
|
|
21
|
-
const
|
|
22
|
-
const localize = nls.loadMessageBundle();
|
|
21
|
+
const l10n = require("@vscode/l10n");
|
|
23
22
|
class CSSCodeActions {
|
|
24
23
|
constructor(cssDataManager) {
|
|
25
24
|
this.cssDataManager = cssDataManager;
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
let maxActions = 3;
|
|
56
55
|
for (const candidate of candidates) {
|
|
57
56
|
const propertyName = candidate.property;
|
|
58
|
-
const title =
|
|
57
|
+
const title = l10n.t("Rename to '{0}'", propertyName);
|
|
59
58
|
const edit = cssLanguageTypes_1.TextEdit.replace(marker.range, propertyName);
|
|
60
59
|
const documentIdentifier = cssLanguageTypes_1.VersionedTextDocumentIdentifier.create(document.uri, document.version);
|
|
61
60
|
const workspaceEdit = { documentChanges: [cssLanguageTypes_1.TextDocumentEdit.create(documentIdentifier, [edit])] };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "../parser/cssNodes", "../parser/cssSymbolScope", "../languageFacts/facts", "../utils/strings", "../cssLanguageTypes", "vscode
|
|
7
|
+
define(["require", "exports", "../parser/cssNodes", "../parser/cssSymbolScope", "../languageFacts/facts", "../utils/strings", "../cssLanguageTypes", "@vscode/l10n", "../utils/objects", "./pathCompletion"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
const languageFacts = require("../languageFacts/facts");
|
|
20
20
|
const strings = require("../utils/strings");
|
|
21
21
|
const cssLanguageTypes_1 = require("../cssLanguageTypes");
|
|
22
|
-
const
|
|
22
|
+
const l10n = require("@vscode/l10n");
|
|
23
23
|
const objects_1 = require("../utils/objects");
|
|
24
24
|
const pathCompletion_1 = require("./pathCompletion");
|
|
25
|
-
const localize = nls.loadMessageBundle();
|
|
26
25
|
const SnippetFormat = cssLanguageTypes_1.InsertTextFormat.Snippet;
|
|
27
26
|
const retriggerCommand = {
|
|
28
27
|
title: 'Suggest',
|
|
@@ -68,6 +67,7 @@
|
|
|
68
67
|
const pathCompletionResult = await participant.computeCompletions(document, documentContext);
|
|
69
68
|
return {
|
|
70
69
|
isIncomplete: result.isIncomplete || pathCompletionResult.isIncomplete,
|
|
70
|
+
itemDefaults: result.itemDefaults,
|
|
71
71
|
items: pathCompletionResult.items.concat(result.items)
|
|
72
72
|
};
|
|
73
73
|
}
|
|
@@ -84,7 +84,16 @@
|
|
|
84
84
|
this.styleSheet = styleSheet;
|
|
85
85
|
this.documentSettings = documentSettings;
|
|
86
86
|
try {
|
|
87
|
-
const result = {
|
|
87
|
+
const result = {
|
|
88
|
+
isIncomplete: false,
|
|
89
|
+
itemDefaults: {
|
|
90
|
+
editRange: {
|
|
91
|
+
start: { line: position.line, character: position.character - this.currentWord.length },
|
|
92
|
+
end: position
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
items: []
|
|
96
|
+
};
|
|
88
97
|
this.nodePath = nodes.getNodePath(this.styleSheet, this.offset);
|
|
89
98
|
for (let i = this.nodePath.length - 1; i >= 0; i--) {
|
|
90
99
|
const node = this.nodePath[i];
|
|
@@ -412,7 +421,7 @@
|
|
|
412
421
|
if (symbol.node.type === nodes.NodeType.FunctionParameter) {
|
|
413
422
|
const mixinNode = (symbol.node.getParent());
|
|
414
423
|
if (mixinNode.type === nodes.NodeType.MixinDeclaration) {
|
|
415
|
-
completionItem.detail =
|
|
424
|
+
completionItem.detail = l10n.t('argument from \'{0}\'', mixinNode.getName());
|
|
416
425
|
}
|
|
417
426
|
}
|
|
418
427
|
result.items.push(completionItem);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "../cssLanguageTypes", "vscode
|
|
7
|
+
define(["require", "exports", "../cssLanguageTypes", "@vscode/l10n", "../parser/cssNodes", "../parser/cssSymbolScope", "../languageFacts/facts", "../utils/strings", "../utils/resources"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.CSSNavigation = void 0;
|
|
17
17
|
const cssLanguageTypes_1 = require("../cssLanguageTypes");
|
|
18
|
-
const
|
|
18
|
+
const l10n = require("@vscode/l10n");
|
|
19
19
|
const nodes = require("../parser/cssNodes");
|
|
20
20
|
const cssSymbolScope_1 = require("../parser/cssSymbolScope");
|
|
21
21
|
const facts_1 = require("../languageFacts/facts");
|
|
22
22
|
const strings_1 = require("../utils/strings");
|
|
23
23
|
const resources_1 = require("../utils/resources");
|
|
24
|
-
const localize = nls.loadMessageBundle();
|
|
25
24
|
const startsWithSchemeRegex = /^\w+:\/\//;
|
|
26
25
|
const startsWithData = /^data:/;
|
|
27
26
|
class CSSNavigation {
|
|
@@ -54,16 +53,23 @@
|
|
|
54
53
|
};
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
const result = [];
|
|
56
|
+
getHighlightNode(document, position, stylesheet) {
|
|
59
57
|
const offset = document.offsetAt(position);
|
|
60
58
|
let node = nodes.getNodeAtOffset(stylesheet, offset);
|
|
61
59
|
if (!node || node.type === nodes.NodeType.Stylesheet || node.type === nodes.NodeType.Declarations) {
|
|
62
|
-
return
|
|
60
|
+
return;
|
|
63
61
|
}
|
|
64
62
|
if (node.type === nodes.NodeType.Identifier && node.parent && node.parent.type === nodes.NodeType.ClassSelector) {
|
|
65
63
|
node = node.parent;
|
|
66
64
|
}
|
|
65
|
+
return node;
|
|
66
|
+
}
|
|
67
|
+
findDocumentHighlights(document, position, stylesheet) {
|
|
68
|
+
const result = [];
|
|
69
|
+
const node = this.getHighlightNode(document, position, stylesheet);
|
|
70
|
+
if (!node) {
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
67
73
|
const symbols = new cssSymbolScope_1.Symbols(stylesheet);
|
|
68
74
|
const symbol = symbols.findSymbolFromNode(node);
|
|
69
75
|
const name = node.getText();
|
|
@@ -241,11 +247,11 @@
|
|
|
241
247
|
collect(node.getName(), cssLanguageTypes_1.SymbolKind.Function, node, node.getIdentifier(), node.getDeclarations());
|
|
242
248
|
}
|
|
243
249
|
else if (node instanceof nodes.Keyframe) {
|
|
244
|
-
const name =
|
|
250
|
+
const name = l10n.t("@keyframes {0}", node.getName());
|
|
245
251
|
collect(name, cssLanguageTypes_1.SymbolKind.Class, node, node.getIdentifier(), node.getDeclarations());
|
|
246
252
|
}
|
|
247
253
|
else if (node instanceof nodes.FontFace) {
|
|
248
|
-
const name =
|
|
254
|
+
const name = l10n.t("@font-face");
|
|
249
255
|
collect(name, cssLanguageTypes_1.SymbolKind.Class, node, undefined, node.getDeclarations());
|
|
250
256
|
}
|
|
251
257
|
else if (node instanceof nodes.Media) {
|
|
@@ -305,6 +311,12 @@
|
|
|
305
311
|
result.push({ label: label, textEdit: cssLanguageTypes_1.TextEdit.replace(range, label) });
|
|
306
312
|
return result;
|
|
307
313
|
}
|
|
314
|
+
prepareRename(document, position, stylesheet) {
|
|
315
|
+
const node = this.getHighlightNode(document, position, stylesheet);
|
|
316
|
+
if (node) {
|
|
317
|
+
return cssLanguageTypes_1.Range.create(document.positionAt(node.offset), document.positionAt(node.end));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
308
320
|
doRename(document, position, newName, stylesheet) {
|
|
309
321
|
const highlights = this.findDocumentHighlights(document, position, stylesheet);
|
|
310
322
|
const edits = highlights.map(h => cssLanguageTypes_1.TextEdit.replace(h.range, newName));
|