vscode-css-languageservice 6.1.0 → 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 (45) 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 +25 -4
  11. package/lib/esm/parser/cssParser.js +31 -16
  12. package/lib/esm/parser/lessParser.js +1 -0
  13. package/lib/esm/parser/scssErrors.js +4 -5
  14. package/lib/esm/parser/scssParser.js +4 -0
  15. package/lib/esm/services/cssCodeActions.js +2 -3
  16. package/lib/esm/services/cssCompletion.js +13 -4
  17. package/lib/esm/services/cssNavigation.js +44 -25
  18. package/lib/esm/services/lessCompletion.js +58 -59
  19. package/lib/esm/services/lint.js +64 -18
  20. package/lib/esm/services/lintRules.js +21 -22
  21. package/lib/esm/services/scssCompletion.js +107 -107
  22. package/lib/esm/services/scssNavigation.js +35 -57
  23. package/lib/esm/services/selectorPrinting.js +2 -3
  24. package/lib/umd/beautify/beautify-css.js +1 -1
  25. package/lib/umd/cssLanguageService.d.ts +2 -1
  26. package/lib/umd/cssLanguageService.js +1 -0
  27. package/lib/umd/cssLanguageTypes.d.ts +2 -2
  28. package/lib/umd/data/webCustomData.js +3502 -310
  29. package/lib/umd/languageFacts/colors.js +7 -8
  30. package/lib/umd/parser/cssErrors.js +35 -36
  31. package/lib/umd/parser/cssNodes.js +27 -5
  32. package/lib/umd/parser/cssParser.js +31 -16
  33. package/lib/umd/parser/lessParser.js +1 -0
  34. package/lib/umd/parser/scssErrors.js +5 -6
  35. package/lib/umd/parser/scssParser.js +4 -0
  36. package/lib/umd/services/cssCodeActions.js +3 -4
  37. package/lib/umd/services/cssCompletion.js +14 -5
  38. package/lib/umd/services/cssNavigation.js +45 -26
  39. package/lib/umd/services/lessCompletion.js +59 -60
  40. package/lib/umd/services/lint.js +65 -19
  41. package/lib/umd/services/lintRules.js +22 -23
  42. package/lib/umd/services/scssCompletion.js +108 -108
  43. package/lib/umd/services/scssNavigation.js +34 -56
  44. package/lib/umd/services/selectorPrinting.js +3 -4
  45. package/package.json +13 -16
@@ -6,8 +6,8 @@
6
6
  import { CSSCompletion } from './cssCompletion';
7
7
  import * as nodes from '../parser/cssNodes';
8
8
  import { CompletionItemKind, TextEdit, InsertTextFormat } from '../cssLanguageTypes';
9
- import * as nls from 'vscode-nls';
10
- const localize = nls.loadMessageBundle();
9
+ import * as l10n from '@vscode/l10n';
10
+ const sassDocumentationName = l10n.t('Sass documentation');
11
11
  export class SCSSCompletion extends CSSCompletion {
12
12
  constructor(lsServiceOptions, cssDataManager) {
13
13
  super('$', lsServiceOptions, cssDataManager);
@@ -125,172 +125,172 @@ SCSSCompletion.variableDefaults = {
125
125
  '$limit': '1'
126
126
  };
127
127
  SCSSCompletion.colorProposals = [
128
- { func: 'red($color)', desc: localize('scss.builtin.red', 'Gets the red component of a color.') },
129
- { func: 'green($color)', desc: localize('scss.builtin.green', 'Gets the green component of a color.') },
130
- { func: 'blue($color)', desc: localize('scss.builtin.blue', 'Gets the blue component of a color.') },
131
- { func: 'mix($color, $color, [$weight])', desc: localize('scss.builtin.mix', 'Mixes two colors together.') },
132
- { func: 'hue($color)', desc: localize('scss.builtin.hue', 'Gets the hue component of a color.') },
133
- { func: 'saturation($color)', desc: localize('scss.builtin.saturation', 'Gets the saturation component of a color.') },
134
- { func: 'lightness($color)', desc: localize('scss.builtin.lightness', 'Gets the lightness component of a color.') },
135
- { func: 'adjust-hue($color, $degrees)', desc: localize('scss.builtin.adjust-hue', 'Changes the hue of a color.') },
136
- { func: 'lighten($color, $amount)', desc: localize('scss.builtin.lighten', 'Makes a color lighter.') },
137
- { func: 'darken($color, $amount)', desc: localize('scss.builtin.darken', 'Makes a color darker.') },
138
- { func: 'saturate($color, $amount)', desc: localize('scss.builtin.saturate', 'Makes a color more saturated.') },
139
- { func: 'desaturate($color, $amount)', desc: localize('scss.builtin.desaturate', 'Makes a color less saturated.') },
140
- { func: 'grayscale($color)', desc: localize('scss.builtin.grayscale', 'Converts a color to grayscale.') },
141
- { func: 'complement($color)', desc: localize('scss.builtin.complement', 'Returns the complement of a color.') },
142
- { func: 'invert($color)', desc: localize('scss.builtin.invert', 'Returns the inverse of a color.') },
143
- { func: 'alpha($color)', desc: localize('scss.builtin.alpha', 'Gets the opacity component of a color.') },
128
+ { func: 'red($color)', desc: l10n.t('Gets the red component of a color.') },
129
+ { func: 'green($color)', desc: l10n.t('Gets the green component of a color.') },
130
+ { func: 'blue($color)', desc: l10n.t('Gets the blue component of a color.') },
131
+ { func: 'mix($color, $color, [$weight])', desc: l10n.t('Mixes two colors together.') },
132
+ { func: 'hue($color)', desc: l10n.t('Gets the hue component of a color.') },
133
+ { func: 'saturation($color)', desc: l10n.t('Gets the saturation component of a color.') },
134
+ { func: 'lightness($color)', desc: l10n.t('Gets the lightness component of a color.') },
135
+ { func: 'adjust-hue($color, $degrees)', desc: l10n.t('Changes the hue of a color.') },
136
+ { func: 'lighten($color, $amount)', desc: l10n.t('Makes a color lighter.') },
137
+ { func: 'darken($color, $amount)', desc: l10n.t('Makes a color darker.') },
138
+ { func: 'saturate($color, $amount)', desc: l10n.t('Makes a color more saturated.') },
139
+ { func: 'desaturate($color, $amount)', desc: l10n.t('Makes a color less saturated.') },
140
+ { func: 'grayscale($color)', desc: l10n.t('Converts a color to grayscale.') },
141
+ { func: 'complement($color)', desc: l10n.t('Returns the complement of a color.') },
142
+ { func: 'invert($color)', desc: l10n.t('Returns the inverse of a color.') },
143
+ { func: 'alpha($color)', desc: l10n.t('Gets the opacity component of a color.') },
144
144
  { func: 'opacity($color)', desc: 'Gets the alpha component (opacity) of a color.' },
145
- { func: 'rgba($color, $alpha)', desc: localize('scss.builtin.rgba', 'Changes the alpha component for a color.') },
146
- { func: 'opacify($color, $amount)', desc: localize('scss.builtin.opacify', 'Makes a color more opaque.') },
147
- { func: 'fade-in($color, $amount)', desc: localize('scss.builtin.fade-in', 'Makes a color more opaque.') },
148
- { func: 'transparentize($color, $amount)', desc: localize('scss.builtin.transparentize', 'Makes a color more transparent.') },
149
- { func: 'fade-out($color, $amount)', desc: localize('scss.builtin.fade-out', 'Makes a color more transparent.') },
150
- { func: 'adjust-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])', desc: localize('scss.builtin.adjust-color', 'Increases or decreases one or more components of a color.') },
151
- { func: 'scale-color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])', desc: localize('scss.builtin.scale-color', 'Fluidly scales one or more properties of a color.') },
152
- { func: 'change-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])', desc: localize('scss.builtin.change-color', 'Changes one or more properties of a color.') },
153
- { func: 'ie-hex-str($color)', desc: localize('scss.builtin.ie-hex-str', 'Converts a color into the format understood by IE filters.') }
145
+ { func: 'rgba($color, $alpha)', desc: l10n.t('Changes the alpha component for a color.') },
146
+ { func: 'opacify($color, $amount)', desc: l10n.t('Makes a color more opaque.') },
147
+ { func: 'fade-in($color, $amount)', desc: l10n.t('Makes a color more opaque.') },
148
+ { func: 'transparentize($color, $amount)', desc: l10n.t('Makes a color more transparent.') },
149
+ { func: 'fade-out($color, $amount)', desc: l10n.t('Makes a color more transparent.') },
150
+ { func: 'adjust-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])', desc: l10n.t('Increases or decreases one or more components of a color.') },
151
+ { func: 'scale-color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])', desc: l10n.t('Fluidly scales one or more properties of a color.') },
152
+ { func: 'change-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])', desc: l10n.t('Changes one or more properties of a color.') },
153
+ { func: 'ie-hex-str($color)', desc: l10n.t('Converts a color into the format understood by IE filters.') }
154
154
  ];
155
155
  SCSSCompletion.selectorFuncs = [
156
- { func: 'selector-nest($selectors…)', desc: localize('scss.builtin.selector-nest', 'Nests selector beneath one another like they would be nested in the stylesheet.') },
157
- { func: 'selector-append($selectors…)', desc: localize('scss.builtin.selector-append', 'Appends selectors to one another without spaces in between.') },
158
- { func: 'selector-extend($selector, $extendee, $extender)', desc: localize('scss.builtin.selector-extend', 'Extends $extendee with $extender within $selector.') },
159
- { func: 'selector-replace($selector, $original, $replacement)', desc: localize('scss.builtin.selector-replace', 'Replaces $original with $replacement within $selector.') },
160
- { func: 'selector-unify($selector1, $selector2)', desc: localize('scss.builtin.selector-unify', 'Unifies two selectors to produce a selector that matches elements matched by both.') },
161
- { func: 'is-superselector($super, $sub)', desc: localize('scss.builtin.is-superselector', 'Returns whether $super matches all the elements $sub does, and possibly more.') },
162
- { func: 'simple-selectors($selector)', desc: localize('scss.builtin.simple-selectors', 'Returns the simple selectors that comprise a compound selector.') },
163
- { func: 'selector-parse($selector)', desc: localize('scss.builtin.selector-parse', 'Parses a selector into the format returned by &.') }
156
+ { func: 'selector-nest($selectors…)', desc: l10n.t('Nests selector beneath one another like they would be nested in the stylesheet.') },
157
+ { func: 'selector-append($selectors…)', desc: l10n.t('Appends selectors to one another without spaces in between.') },
158
+ { func: 'selector-extend($selector, $extendee, $extender)', desc: l10n.t('Extends $extendee with $extender within $selector.') },
159
+ { func: 'selector-replace($selector, $original, $replacement)', desc: l10n.t('Replaces $original with $replacement within $selector.') },
160
+ { func: 'selector-unify($selector1, $selector2)', desc: l10n.t('Unifies two selectors to produce a selector that matches elements matched by both.') },
161
+ { func: 'is-superselector($super, $sub)', desc: l10n.t('Returns whether $super matches all the elements $sub does, and possibly more.') },
162
+ { func: 'simple-selectors($selector)', desc: l10n.t('Returns the simple selectors that comprise a compound selector.') },
163
+ { func: 'selector-parse($selector)', desc: l10n.t('Parses a selector into the format returned by &.') }
164
164
  ];
165
165
  SCSSCompletion.builtInFuncs = [
166
- { func: 'unquote($string)', desc: localize('scss.builtin.unquote', 'Removes quotes from a string.') },
167
- { func: 'quote($string)', desc: localize('scss.builtin.quote', 'Adds quotes to a string.') },
168
- { func: 'str-length($string)', desc: localize('scss.builtin.str-length', 'Returns the number of characters in a string.') },
169
- { func: 'str-insert($string, $insert, $index)', desc: localize('scss.builtin.str-insert', 'Inserts $insert into $string at $index.') },
170
- { func: 'str-index($string, $substring)', desc: localize('scss.builtin.str-index', 'Returns the index of the first occurance of $substring in $string.') },
171
- { func: 'str-slice($string, $start-at, [$end-at])', desc: localize('scss.builtin.str-slice', 'Extracts a substring from $string.') },
172
- { func: 'to-upper-case($string)', desc: localize('scss.builtin.to-upper-case', 'Converts a string to upper case.') },
173
- { func: 'to-lower-case($string)', desc: localize('scss.builtin.to-lower-case', 'Converts a string to lower case.') },
174
- { func: 'percentage($number)', desc: localize('scss.builtin.percentage', 'Converts a unitless number to a percentage.'), type: 'percentage' },
175
- { func: 'round($number)', desc: localize('scss.builtin.round', 'Rounds a number to the nearest whole number.') },
176
- { func: 'ceil($number)', desc: localize('scss.builtin.ceil', 'Rounds a number up to the next whole number.') },
177
- { func: 'floor($number)', desc: localize('scss.builtin.floor', 'Rounds a number down to the previous whole number.') },
178
- { func: 'abs($number)', desc: localize('scss.builtin.abs', 'Returns the absolute value of a number.') },
179
- { func: 'min($numbers)', desc: localize('scss.builtin.min', 'Finds the minimum of several numbers.') },
180
- { func: 'max($numbers)', desc: localize('scss.builtin.max', 'Finds the maximum of several numbers.') },
181
- { func: 'random([$limit])', desc: localize('scss.builtin.random', 'Returns a random number.') },
182
- { func: 'length($list)', desc: localize('scss.builtin.length', 'Returns the length of a list.') },
183
- { func: 'nth($list, $n)', desc: localize('scss.builtin.nth', 'Returns a specific item in a list.') },
184
- { func: 'set-nth($list, $n, $value)', desc: localize('scss.builtin.set-nth', 'Replaces the nth item in a list.') },
185
- { func: 'join($list1, $list2, [$separator])', desc: localize('scss.builtin.join', 'Joins together two lists into one.') },
186
- { func: 'append($list1, $val, [$separator])', desc: localize('scss.builtin.append', 'Appends a single value onto the end of a list.') },
187
- { func: 'zip($lists)', desc: localize('scss.builtin.zip', 'Combines several lists into a single multidimensional list.') },
188
- { func: 'index($list, $value)', desc: localize('scss.builtin.index', 'Returns the position of a value within a list.') },
189
- { func: 'list-separator(#list)', desc: localize('scss.builtin.list-separator', 'Returns the separator of a list.') },
190
- { func: 'map-get($map, $key)', desc: localize('scss.builtin.map-get', 'Returns the value in a map associated with a given key.') },
191
- { func: 'map-merge($map1, $map2)', desc: localize('scss.builtin.map-merge', 'Merges two maps together into a new map.') },
192
- { func: 'map-remove($map, $keys)', desc: localize('scss.builtin.map-remove', 'Returns a new map with keys removed.') },
193
- { func: 'map-keys($map)', desc: localize('scss.builtin.map-keys', 'Returns a list of all keys in a map.') },
194
- { func: 'map-values($map)', desc: localize('scss.builtin.map-values', 'Returns a list of all values in a map.') },
195
- { func: 'map-has-key($map, $key)', desc: localize('scss.builtin.map-has-key', 'Returns whether a map has a value associated with a given key.') },
196
- { func: 'keywords($args)', desc: localize('scss.builtin.keywords', 'Returns the keywords passed to a function that takes variable arguments.') },
197
- { func: 'feature-exists($feature)', desc: localize('scss.builtin.feature-exists', 'Returns whether a feature exists in the current Sass runtime.') },
198
- { func: 'variable-exists($name)', desc: localize('scss.builtin.variable-exists', 'Returns whether a variable with the given name exists in the current scope.') },
199
- { func: 'global-variable-exists($name)', desc: localize('scss.builtin.global-variable-exists', 'Returns whether a variable with the given name exists in the global scope.') },
200
- { func: 'function-exists($name)', desc: localize('scss.builtin.function-exists', 'Returns whether a function with the given name exists.') },
201
- { func: 'mixin-exists($name)', desc: localize('scss.builtin.mixin-exists', 'Returns whether a mixin with the given name exists.') },
202
- { func: 'inspect($value)', desc: localize('scss.builtin.inspect', 'Returns the string representation of a value as it would be represented in Sass.') },
203
- { func: 'type-of($value)', desc: localize('scss.builtin.type-of', 'Returns the type of a value.') },
204
- { func: 'unit($number)', desc: localize('scss.builtin.unit', 'Returns the unit(s) associated with a number.') },
205
- { func: 'unitless($number)', desc: localize('scss.builtin.unitless', 'Returns whether a number has units.') },
206
- { func: 'comparable($number1, $number2)', desc: localize('scss.builtin.comparable', 'Returns whether two numbers can be added, subtracted, or compared.') },
207
- { func: 'call($name, $args…)', desc: localize('scss.builtin.call', 'Dynamically calls a Sass function.') }
166
+ { func: 'unquote($string)', desc: l10n.t('Removes quotes from a string.') },
167
+ { func: 'quote($string)', desc: l10n.t('Adds quotes to a string.') },
168
+ { func: 'str-length($string)', desc: l10n.t('Returns the number of characters in a string.') },
169
+ { func: 'str-insert($string, $insert, $index)', desc: l10n.t('Inserts $insert into $string at $index.') },
170
+ { func: 'str-index($string, $substring)', desc: l10n.t('Returns the index of the first occurance of $substring in $string.') },
171
+ { func: 'str-slice($string, $start-at, [$end-at])', desc: l10n.t('Extracts a substring from $string.') },
172
+ { func: 'to-upper-case($string)', desc: l10n.t('Converts a string to upper case.') },
173
+ { func: 'to-lower-case($string)', desc: l10n.t('Converts a string to lower case.') },
174
+ { func: 'percentage($number)', desc: l10n.t('Converts a unitless number to a percentage.'), type: 'percentage' },
175
+ { func: 'round($number)', desc: l10n.t('Rounds a number to the nearest whole number.') },
176
+ { func: 'ceil($number)', desc: l10n.t('Rounds a number up to the next whole number.') },
177
+ { func: 'floor($number)', desc: l10n.t('Rounds a number down to the previous whole number.') },
178
+ { func: 'abs($number)', desc: l10n.t('Returns the absolute value of a number.') },
179
+ { func: 'min($numbers)', desc: l10n.t('Finds the minimum of several numbers.') },
180
+ { func: 'max($numbers)', desc: l10n.t('Finds the maximum of several numbers.') },
181
+ { func: 'random([$limit])', desc: l10n.t('Returns a random number.') },
182
+ { func: 'length($list)', desc: l10n.t('Returns the length of a list.') },
183
+ { func: 'nth($list, $n)', desc: l10n.t('Returns a specific item in a list.') },
184
+ { func: 'set-nth($list, $n, $value)', desc: l10n.t('Replaces the nth item in a list.') },
185
+ { func: 'join($list1, $list2, [$separator])', desc: l10n.t('Joins together two lists into one.') },
186
+ { func: 'append($list1, $val, [$separator])', desc: l10n.t('Appends a single value onto the end of a list.') },
187
+ { func: 'zip($lists)', desc: l10n.t('Combines several lists into a single multidimensional list.') },
188
+ { func: 'index($list, $value)', desc: l10n.t('Returns the position of a value within a list.') },
189
+ { func: 'list-separator(#list)', desc: l10n.t('Returns the separator of a list.') },
190
+ { func: 'map-get($map, $key)', desc: l10n.t('Returns the value in a map associated with a given key.') },
191
+ { func: 'map-merge($map1, $map2)', desc: l10n.t('Merges two maps together into a new map.') },
192
+ { func: 'map-remove($map, $keys)', desc: l10n.t('Returns a new map with keys removed.') },
193
+ { func: 'map-keys($map)', desc: l10n.t('Returns a list of all keys in a map.') },
194
+ { func: 'map-values($map)', desc: l10n.t('Returns a list of all values in a map.') },
195
+ { func: 'map-has-key($map, $key)', desc: l10n.t('Returns whether a map has a value associated with a given key.') },
196
+ { func: 'keywords($args)', desc: l10n.t('Returns the keywords passed to a function that takes variable arguments.') },
197
+ { func: 'feature-exists($feature)', desc: l10n.t('Returns whether a feature exists in the current Sass runtime.') },
198
+ { func: 'variable-exists($name)', desc: l10n.t('Returns whether a variable with the given name exists in the current scope.') },
199
+ { func: 'global-variable-exists($name)', desc: l10n.t('Returns whether a variable with the given name exists in the global scope.') },
200
+ { func: 'function-exists($name)', desc: l10n.t('Returns whether a function with the given name exists.') },
201
+ { func: 'mixin-exists($name)', desc: l10n.t('Returns whether a mixin with the given name exists.') },
202
+ { func: 'inspect($value)', desc: l10n.t('Returns the string representation of a value as it would be represented in Sass.') },
203
+ { func: 'type-of($value)', desc: l10n.t('Returns the type of a value.') },
204
+ { func: 'unit($number)', desc: l10n.t('Returns the unit(s) associated with a number.') },
205
+ { func: 'unitless($number)', desc: l10n.t('Returns whether a number has units.') },
206
+ { func: 'comparable($number1, $number2)', desc: l10n.t('Returns whether two numbers can be added, subtracted, or compared.') },
207
+ { func: 'call($name, $args…)', desc: l10n.t('Dynamically calls a Sass function.') }
208
208
  ];
209
209
  SCSSCompletion.scssAtDirectives = [
210
210
  {
211
211
  label: "@extend",
212
- documentation: localize("scss.builtin.@extend", "Inherits the styles of another selector."),
212
+ documentation: l10n.t("Inherits the styles of another selector."),
213
213
  kind: CompletionItemKind.Keyword
214
214
  },
215
215
  {
216
216
  label: "@at-root",
217
- documentation: localize("scss.builtin.@at-root", "Causes one or more rules to be emitted at the root of the document."),
217
+ documentation: l10n.t("Causes one or more rules to be emitted at the root of the document."),
218
218
  kind: CompletionItemKind.Keyword
219
219
  },
220
220
  {
221
221
  label: "@debug",
222
- documentation: localize("scss.builtin.@debug", "Prints the value of an expression to the standard error output stream. Useful for debugging complicated Sass files."),
222
+ documentation: l10n.t("Prints the value of an expression to the standard error output stream. Useful for debugging complicated Sass files."),
223
223
  kind: CompletionItemKind.Keyword
224
224
  },
225
225
  {
226
226
  label: "@warn",
227
- 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."),
227
+ documentation: l10n.t("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."),
228
228
  kind: CompletionItemKind.Keyword
229
229
  },
230
230
  {
231
231
  label: "@error",
232
- 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."),
232
+ documentation: l10n.t("Throws the value of an expression as a fatal error with stack trace. Useful for validating arguments to mixins and functions."),
233
233
  kind: CompletionItemKind.Keyword
234
234
  },
235
235
  {
236
236
  label: "@if",
237
- documentation: localize("scss.builtin.@if", "Includes the body if the expression does not evaluate to `false` or `null`."),
237
+ documentation: l10n.t("Includes the body if the expression does not evaluate to `false` or `null`."),
238
238
  insertText: "@if ${1:expr} {\n\t$0\n}",
239
239
  insertTextFormat: InsertTextFormat.Snippet,
240
240
  kind: CompletionItemKind.Keyword
241
241
  },
242
242
  {
243
243
  label: "@for",
244
- 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."),
244
+ documentation: l10n.t("For loop that repeatedly outputs a set of styles for each `$var` in the `from/through` or `from/to` clause."),
245
245
  insertText: "@for \\$${1:var} from ${2:start} ${3|to,through|} ${4:end} {\n\t$0\n}",
246
246
  insertTextFormat: InsertTextFormat.Snippet,
247
247
  kind: CompletionItemKind.Keyword
248
248
  },
249
249
  {
250
250
  label: "@each",
251
- 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`."),
251
+ documentation: l10n.t("Each loop that sets `$var` to each item in the list or map, then outputs the styles it contains using that value of `$var`."),
252
252
  insertText: "@each \\$${1:var} in ${2:list} {\n\t$0\n}",
253
253
  insertTextFormat: InsertTextFormat.Snippet,
254
254
  kind: CompletionItemKind.Keyword
255
255
  },
256
256
  {
257
257
  label: "@while",
258
- documentation: localize("scss.builtin.@while", "While loop that takes an expression and repeatedly outputs the nested styles until the statement evaluates to `false`."),
258
+ documentation: l10n.t("While loop that takes an expression and repeatedly outputs the nested styles until the statement evaluates to `false`."),
259
259
  insertText: "@while ${1:condition} {\n\t$0\n}",
260
260
  insertTextFormat: InsertTextFormat.Snippet,
261
261
  kind: CompletionItemKind.Keyword
262
262
  },
263
263
  {
264
264
  label: "@mixin",
265
- documentation: localize("scss.builtin.@mixin", "Defines styles that can be re-used throughout the stylesheet with `@include`."),
265
+ documentation: l10n.t("Defines styles that can be re-used throughout the stylesheet with `@include`."),
266
266
  insertText: "@mixin ${1:name} {\n\t$0\n}",
267
267
  insertTextFormat: InsertTextFormat.Snippet,
268
268
  kind: CompletionItemKind.Keyword
269
269
  },
270
270
  {
271
271
  label: "@include",
272
- documentation: localize("scss.builtin.@include", "Includes the styles defined by another mixin into the current rule."),
272
+ documentation: l10n.t("Includes the styles defined by another mixin into the current rule."),
273
273
  kind: CompletionItemKind.Keyword
274
274
  },
275
275
  {
276
276
  label: "@function",
277
- documentation: localize("scss.builtin.@function", "Defines complex operations that can be re-used throughout stylesheets."),
277
+ documentation: l10n.t("Defines complex operations that can be re-used throughout stylesheets."),
278
278
  kind: CompletionItemKind.Keyword
279
279
  }
280
280
  ];
281
281
  SCSSCompletion.scssModuleLoaders = [
282
282
  {
283
283
  label: "@use",
284
- documentation: localize("scss.builtin.@use", "Loads mixins, functions, and variables from other Sass stylesheets as 'modules', and combines CSS from multiple stylesheets together."),
285
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/at-rules/use' }],
284
+ documentation: l10n.t("Loads mixins, functions, and variables from other Sass stylesheets as 'modules', and combines CSS from multiple stylesheets together."),
285
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/at-rules/use' }],
286
286
  insertText: "@use $0;",
287
287
  insertTextFormat: InsertTextFormat.Snippet,
288
288
  kind: CompletionItemKind.Keyword
289
289
  },
290
290
  {
291
291
  label: "@forward",
292
- documentation: localize("scss.builtin.@forward", "Loads a Sass stylesheet and makes its mixins, functions, and variables available when this stylesheet is loaded with the @use rule."),
293
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/at-rules/forward' }],
292
+ documentation: l10n.t("Loads a Sass stylesheet and makes its mixins, functions, and variables available when this stylesheet is loaded with the @use rule."),
293
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/at-rules/forward' }],
294
294
  insertText: "@forward $0;",
295
295
  insertTextFormat: InsertTextFormat.Snippet,
296
296
  kind: CompletionItemKind.Keyword
@@ -299,38 +299,38 @@ SCSSCompletion.scssModuleLoaders = [
299
299
  SCSSCompletion.scssModuleBuiltIns = [
300
300
  {
301
301
  label: 'sass:math',
302
- documentation: localize('scss.builtin.sass:math', 'Provides functions that operate on numbers.'),
303
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/math' }]
302
+ documentation: l10n.t('Provides functions that operate on numbers.'),
303
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/modules/math' }]
304
304
  },
305
305
  {
306
306
  label: 'sass:string',
307
- documentation: localize('scss.builtin.sass:string', 'Makes it easy to combine, search, or split apart strings.'),
308
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/string' }]
307
+ documentation: l10n.t('Makes it easy to combine, search, or split apart strings.'),
308
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/modules/string' }]
309
309
  },
310
310
  {
311
311
  label: 'sass:color',
312
- documentation: localize('scss.builtin.sass:color', 'Generates new colors based on existing ones, making it easy to build color themes.'),
313
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/color' }]
312
+ documentation: l10n.t('Generates new colors based on existing ones, making it easy to build color themes.'),
313
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/modules/color' }]
314
314
  },
315
315
  {
316
316
  label: 'sass:list',
317
- documentation: localize('scss.builtin.sass:list', 'Lets you access and modify values in lists.'),
318
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/list' }]
317
+ documentation: l10n.t('Lets you access and modify values in lists.'),
318
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/modules/list' }]
319
319
  },
320
320
  {
321
321
  label: 'sass:map',
322
- documentation: localize('scss.builtin.sass:map', 'Makes it possible to look up the value associated with a key in a map, and much more.'),
323
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/map' }]
322
+ documentation: l10n.t('Makes it possible to look up the value associated with a key in a map, and much more.'),
323
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/modules/map' }]
324
324
  },
325
325
  {
326
326
  label: 'sass:selector',
327
- documentation: localize('scss.builtin.sass:selector', 'Provides access to Sass’s powerful selector engine.'),
328
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/selector' }]
327
+ documentation: l10n.t('Provides access to Sass’s powerful selector engine.'),
328
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/modules/selector' }]
329
329
  },
330
330
  {
331
331
  label: 'sass:meta',
332
- documentation: localize('scss.builtin.sass:meta', 'Exposes the details of Sass’s inner workings.'),
333
- references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/meta' }]
332
+ documentation: l10n.t('Exposes the details of Sass’s inner workings.'),
333
+ references: [{ name: sassDocumentationName, url: 'https://sass-lang.com/documentation/modules/meta' }]
334
334
  },
335
335
  ];
336
336
  /**
@@ -5,7 +5,7 @@
5
5
  'use strict';
6
6
  import { CSSNavigation } from './cssNavigation';
7
7
  import * as nodes from '../parser/cssNodes';
8
- import { URI } from 'vscode-uri';
8
+ import { URI, Utils } from 'vscode-uri';
9
9
  import { startsWith } from '../utils/strings';
10
10
  export class SCSSNavigation extends CSSNavigation {
11
11
  constructor(fileSystemProvider) {
@@ -16,67 +16,45 @@ export class SCSSNavigation extends CSSNavigation {
16
16
  node.type === nodes.NodeType.Use ||
17
17
  node.type === nodes.NodeType.Forward);
18
18
  }
19
- async resolveRelativeReference(ref, documentUri, documentContext, isRawLink) {
20
- if (startsWith(ref, 'sass:')) {
21
- return undefined; // sass library
22
- }
23
- const target = await super.resolveRelativeReference(ref, documentUri, documentContext, isRawLink);
19
+ async mapReference(target, isRawLink) {
24
20
  if (this.fileSystemProvider && target && isRawLink) {
25
- const parsedUri = URI.parse(target);
26
- try {
27
- const pathVariations = toPathVariations(parsedUri);
28
- if (pathVariations) {
29
- for (let j = 0; j < pathVariations.length; j++) {
30
- if (await this.fileExists(pathVariations[j])) {
31
- return pathVariations[j];
32
- }
33
- }
21
+ const pathVariations = toPathVariations(target);
22
+ for (const variation of pathVariations) {
23
+ if (await this.fileExists(variation)) {
24
+ return variation;
34
25
  }
35
26
  }
36
- catch (e) {
37
- // ignore
38
- }
39
27
  }
40
28
  return target;
41
- function toPathVariations(uri) {
42
- // No valid path
43
- if (uri.path === '') {
44
- return undefined;
45
- }
46
- // No variation for links that ends with suffix
47
- if (uri.path.endsWith('.scss') || uri.path.endsWith('.css')) {
48
- return undefined;
49
- }
50
- // If a link is like a/, try resolving a/index.scss and a/_index.scss
51
- if (uri.path.endsWith('/')) {
52
- return [
53
- uri.with({ path: uri.path + 'index.scss' }).toString(true),
54
- uri.with({ path: uri.path + '_index.scss' }).toString(true)
55
- ];
56
- }
57
- // Use `uri.path` since it's normalized to use `/` in all platforms
58
- const pathFragments = uri.path.split('/');
59
- const basename = pathFragments[pathFragments.length - 1];
60
- const pathWithoutBasename = uri.path.slice(0, -basename.length);
61
- // No variation for links such as _a
62
- if (basename.startsWith('_')) {
63
- if (uri.path.endsWith('.scss')) {
64
- return undefined;
65
- }
66
- else {
67
- return [uri.with({ path: uri.path + '.scss' }).toString(true)];
68
- }
69
- }
70
- const normalizedBasename = basename + '.scss';
71
- const documentUriWithBasename = (newBasename) => {
72
- return uri.with({ path: pathWithoutBasename + newBasename }).toString(true);
73
- };
74
- const normalizedPath = documentUriWithBasename(normalizedBasename);
75
- const underScorePath = documentUriWithBasename('_' + normalizedBasename);
76
- const indexPath = documentUriWithBasename(normalizedBasename.slice(0, -5) + '/index.scss');
77
- const indexUnderscoreUri = documentUriWithBasename(normalizedBasename.slice(0, -5) + '/_index.scss');
78
- const cssPath = documentUriWithBasename(normalizedBasename.slice(0, -5) + '.css');
79
- return [normalizedPath, underScorePath, indexPath, indexUnderscoreUri, cssPath];
29
+ }
30
+ async resolveReference(target, documentUri, documentContext, isRawLink = false) {
31
+ if (startsWith(target, 'sass:')) {
32
+ return undefined; // sass library
80
33
  }
34
+ return super.resolveReference(target, documentUri, documentContext, isRawLink);
35
+ }
36
+ }
37
+ function toPathVariations(target) {
38
+ // No variation for links that ends with suffix
39
+ if (target.endsWith('.scss') || target.endsWith('.css')) {
40
+ return [target];
41
+ }
42
+ // If a link is like a/, try resolving a/index.scss and a/_index.scss
43
+ if (target.endsWith('/')) {
44
+ return [target + 'index.scss', target + '_index.scss'];
45
+ }
46
+ const targetUri = URI.parse(target);
47
+ const basename = Utils.basename(targetUri);
48
+ const dirname = Utils.dirname(targetUri);
49
+ if (basename.startsWith('_')) {
50
+ // No variation for links such as _a
51
+ return [Utils.joinPath(dirname, basename + '.scss').toString(true)];
81
52
  }
53
+ return [
54
+ Utils.joinPath(dirname, basename + '.scss').toString(true),
55
+ Utils.joinPath(dirname, '_' + basename + '.scss').toString(true),
56
+ target + '/index.scss',
57
+ target + '/_index.scss',
58
+ Utils.joinPath(dirname, basename + '.css').toString(true)
59
+ ];
82
60
  }
@@ -5,8 +5,7 @@
5
5
  'use strict';
6
6
  import * as nodes from '../parser/cssNodes';
7
7
  import { Scanner } from '../parser/cssScanner';
8
- import * as nls from 'vscode-nls';
9
- const localize = nls.loadMessageBundle();
8
+ import * as l10n from '@vscode/l10n';
10
9
  export class Element {
11
10
  constructor() {
12
11
  this.parent = null;
@@ -404,7 +403,7 @@ export class SelectorPrinting {
404
403
  };
405
404
  const specificity = calculateScore(node);
406
405
  ;
407
- return localize('specificity', "[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): ({0}, {1}, {2})", specificity.id, specificity.attr, specificity.tag);
406
+ return l10n.t("[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): ({0}, {1}, {2})", specificity.id, specificity.attr, specificity.tag);
408
407
  }
409
408
  }
410
409
  class SelectorElementBuilder {
@@ -1,5 +1,5 @@
1
1
  // copied from js-beautify/js/lib/beautify-css.js
2
- // version: 1.14.6
2
+ // version: 1.14.7
3
3
  /* AUTO-GENERATED. DO NOT MODIFY. */
4
4
  /*
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1, HoverSettings, CompletionSettings, TextEdit, CSSFormatConfiguration, DocumentSymbol } from './cssLanguageTypes';
2
- export declare type Stylesheet = {};
2
+ export type Stylesheet = {};
3
3
  export * from './cssLanguageTypes';
4
4
  export interface LanguageService {
5
5
  configure(raw?: LanguageSettings): void;
@@ -24,6 +24,7 @@ export interface LanguageService {
24
24
  doCodeActions2(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): CodeAction[];
25
25
  findDocumentColors(document: TextDocument, stylesheet: Stylesheet): ColorInformation[];
26
26
  getColorPresentations(document: TextDocument, stylesheet: Stylesheet, color: Color, range: Range): ColorPresentation[];
27
+ prepareRename(document: TextDocument, position: Position, stylesheet: Stylesheet): Range | undefined;
27
28
  doRename(document: TextDocument, position: Position, newName: string, stylesheet: Stylesheet): WorkspaceEdit;
28
29
  getFoldingRanges(document: TextDocument, context?: {
29
30
  rangeLimit?: number;
@@ -80,6 +80,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
80
80
  doCodeActions2: codeActions.doCodeActions2.bind(codeActions),
81
81
  findDocumentColors: navigation.findDocumentColors.bind(navigation),
82
82
  getColorPresentations: navigation.getColorPresentations.bind(navigation),
83
+ prepareRename: navigation.prepareRename.bind(navigation),
83
84
  doRename: navigation.doRename.bind(navigation),
84
85
  getFoldingRanges: cssFolding_1.getFoldingRanges,
85
86
  getSelectionRanges: cssSelectionRange_1.getSelectionRanges
@@ -1,7 +1,7 @@
1
1
  import { Range, Position, DocumentUri, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind } from 'vscode-languageserver-types';
2
2
  import { TextDocument } from 'vscode-languageserver-textdocument';
3
3
  export { TextDocument, Range, Position, DocumentUri, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind };
4
- export declare type LintSettings = {
4
+ export type LintSettings = {
5
5
  [key: string]: any;
6
6
  };
7
7
  export interface CompletionSettings {
@@ -112,7 +112,7 @@ export interface LanguageServiceOptions {
112
112
  */
113
113
  clientCapabilities?: ClientCapabilities;
114
114
  }
115
- export declare type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete';
115
+ export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete';
116
116
  export interface IReference {
117
117
  name: string;
118
118
  url: string;