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.
Files changed (41) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -3
  3. package/lib/esm/beautify/beautify-css.js +1 -1
  4. package/lib/esm/cssLanguageService.d.ts +2 -1
  5. package/lib/esm/cssLanguageService.js +1 -0
  6. package/lib/esm/cssLanguageTypes.d.ts +2 -2
  7. package/lib/esm/data/webCustomData.js +3502 -310
  8. package/lib/esm/languageFacts/colors.js +6 -7
  9. package/lib/esm/parser/cssErrors.js +34 -35
  10. package/lib/esm/parser/cssNodes.js +4 -4
  11. package/lib/esm/parser/cssParser.js +16 -16
  12. package/lib/esm/parser/scssErrors.js +4 -5
  13. package/lib/esm/parser/scssParser.js +3 -0
  14. package/lib/esm/services/cssCodeActions.js +2 -3
  15. package/lib/esm/services/cssCompletion.js +13 -4
  16. package/lib/esm/services/cssNavigation.js +19 -7
  17. package/lib/esm/services/lessCompletion.js +58 -59
  18. package/lib/esm/services/lint.js +64 -18
  19. package/lib/esm/services/lintRules.js +21 -22
  20. package/lib/esm/services/scssCompletion.js +107 -107
  21. package/lib/esm/services/selectorPrinting.js +2 -3
  22. package/lib/umd/beautify/beautify-css.js +1 -1
  23. package/lib/umd/cssLanguageService.d.ts +2 -1
  24. package/lib/umd/cssLanguageService.js +1 -0
  25. package/lib/umd/cssLanguageTypes.d.ts +2 -2
  26. package/lib/umd/data/webCustomData.js +3502 -310
  27. package/lib/umd/languageFacts/colors.js +7 -8
  28. package/lib/umd/parser/cssErrors.js +35 -36
  29. package/lib/umd/parser/cssNodes.js +4 -4
  30. package/lib/umd/parser/cssParser.js +16 -16
  31. package/lib/umd/parser/scssErrors.js +5 -6
  32. package/lib/umd/parser/scssParser.js +3 -0
  33. package/lib/umd/services/cssCodeActions.js +3 -4
  34. package/lib/umd/services/cssCompletion.js +14 -5
  35. package/lib/umd/services/cssNavigation.js +20 -8
  36. package/lib/umd/services/lessCompletion.js +59 -60
  37. package/lib/umd/services/lint.js +65 -19
  38. package/lib/umd/services/lintRules.js +22 -23
  39. package/lib/umd/services/scssCompletion.js +108 -108
  40. package/lib/umd/services/selectorPrinting.js +3 -4
  41. 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-nls"], factory);
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 nls = require("vscode-nls");
19
- const localize = nls.loadMessageBundle();
18
+ const l10n = require("@vscode/l10n");
20
19
  exports.colorFunctions = [
21
- { func: 'rgb($red, $green, $blue)', desc: localize('css.builtin.rgb', 'Creates a Color from red, green, and blue values.') },
22
- { func: 'rgba($red, $green, $blue, $alpha)', desc: localize('css.builtin.rgba', 'Creates a Color from red, green, blue, and alpha values.') },
23
- { func: 'hsl($hue, $saturation, $lightness)', desc: localize('css.builtin.hsl', 'Creates a Color from hue, saturation, and lightness values.') },
24
- { func: 'hsla($hue, $saturation, $lightness, $alpha)', desc: localize('css.builtin.hsla', 'Creates a Color from hue, saturation, lightness, and alpha values.') },
25
- { func: 'hwb($hue $white $black)', desc: localize('css.builtin.hwb', 'Creates a Color from hue, white and black.') }
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-nls"], factory);
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 nls = require("vscode-nls");
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', localize('expected.number', "number expected")),
28
- ConditionExpected: new CSSIssueType('css-conditionexpected', localize('expected.condt', "condition expected")),
29
- RuleOrSelectorExpected: new CSSIssueType('css-ruleorselectorexpected', localize('expected.ruleorselector', "at-rule or selector expected")),
30
- DotExpected: new CSSIssueType('css-dotexpected', localize('expected.dot', "dot expected")),
31
- ColonExpected: new CSSIssueType('css-colonexpected', localize('expected.colon', "colon expected")),
32
- SemiColonExpected: new CSSIssueType('css-semicolonexpected', localize('expected.semicolon', "semi-colon expected")),
33
- TermExpected: new CSSIssueType('css-termexpected', localize('expected.term', "term expected")),
34
- ExpressionExpected: new CSSIssueType('css-expressionexpected', localize('expected.expression', "expression expected")),
35
- OperatorExpected: new CSSIssueType('css-operatorexpected', localize('expected.operator', "operator expected")),
36
- IdentifierExpected: new CSSIssueType('css-identifierexpected', localize('expected.ident', "identifier expected")),
37
- PercentageExpected: new CSSIssueType('css-percentageexpected', localize('expected.percentage', "percentage expected")),
38
- URIOrStringExpected: new CSSIssueType('css-uriorstringexpected', localize('expected.uriorstring', "uri or string expected")),
39
- URIExpected: new CSSIssueType('css-uriexpected', localize('expected.uri', "URI expected")),
40
- VariableNameExpected: new CSSIssueType('css-varnameexpected', localize('expected.varname', "variable name expected")),
41
- VariableValueExpected: new CSSIssueType('css-varvalueexpected', localize('expected.varvalue', "variable value expected")),
42
- PropertyValueExpected: new CSSIssueType('css-propertyvalueexpected', localize('expected.propvalue', "property value expected")),
43
- LeftCurlyExpected: new CSSIssueType('css-lcurlyexpected', localize('expected.lcurly', "{ expected")),
44
- RightCurlyExpected: new CSSIssueType('css-rcurlyexpected', localize('expected.rcurly', "} expected")),
45
- LeftSquareBracketExpected: new CSSIssueType('css-rbracketexpected', localize('expected.lsquare', "[ expected")),
46
- RightSquareBracketExpected: new CSSIssueType('css-lbracketexpected', localize('expected.rsquare', "] expected")),
47
- LeftParenthesisExpected: new CSSIssueType('css-lparentexpected', localize('expected.lparen', "( expected")),
48
- RightParenthesisExpected: new CSSIssueType('css-rparentexpected', localize('expected.rparent', ") expected")),
49
- CommaExpected: new CSSIssueType('css-commaexpected', localize('expected.comma', "comma expected")),
50
- PageDirectiveOrDeclarationExpected: new CSSIssueType('css-pagedirordeclexpected', localize('expected.pagedirordecl', "page directive or declaraton expected")),
51
- UnknownAtRule: new CSSIssueType('css-unknownatrule', localize('unknown.atrule', "at-rule unknown")),
52
- UnknownKeyword: new CSSIssueType('css-unknownkeyword', localize('unknown.keyword', "unknown keyword")),
53
- SelectorExpected: new CSSIssueType('css-selectorexpected', localize('expected.selector', "selector expected")),
54
- StringLiteralExpected: new CSSIssueType('css-stringliteralexpected', localize('expected.stringliteral', "string literal expected")),
55
- WhitespaceExpected: new CSSIssueType('css-whitespaceexpected', localize('expected.whitespace', "whitespace expected")),
56
- MediaQueryExpected: new CSSIssueType('css-mediaqueryexpected', localize('expected.mediaquery', "media query expected")),
57
- IdentifierOrWildcardExpected: new CSSIssueType('css-idorwildcardexpected', localize('expected.idorwildcard', "identifier or wildcard expected")),
58
- WildcardExpected: new CSSIssueType('css-wildcardexpected', localize('expected.wildcard', "wildcard expected")),
59
- IdentifierOrVariableExpected: new CSSIssueType('css-idorvarexpected', localize('expected.idorvar', "identifier or variable expected")),
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 (parseRangeOperator()) {
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 (parseRangeOperator()) {
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 (!parseRangeOperator()) {
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 (parseRangeOperator()) {
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-nls"], factory);
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 nls = require("vscode-nls");
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', localize('expected.from', "'from' expected")),
28
- ThroughOrToExpected: new SCSSIssueType('scss-throughexpected', localize('expected.through', "'through' or 'to' expected")),
29
- InExpected: new SCSSIssueType('scss-fromexpected', localize('expected.in', "'in' expected")),
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-nls"], factory);
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 nls = require("vscode-nls");
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 = localize('css.codeaction.rename', "Rename to '{0}'", propertyName);
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-nls", "../utils/objects", "./pathCompletion"], factory);
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 nls = require("vscode-nls");
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 = { isIncomplete: false, items: [] };
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 = localize('completion.argument', 'argument from \'{0}\'', mixinNode.getName());
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-nls", "../parser/cssNodes", "../parser/cssSymbolScope", "../languageFacts/facts", "../utils/strings", "../utils/resources"], factory);
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 nls = require("vscode-nls");
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
- findDocumentHighlights(document, position, stylesheet) {
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 result;
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 = localize('literal.keyframes', "@keyframes {0}", node.getName());
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 = localize('literal.fontface', "@font-face");
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));