vscode-css-languageservice 6.2.6 → 6.2.7

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/README.md CHANGED
@@ -18,7 +18,7 @@ and the Monaco editor.
18
18
  - *findDocumentHighlights* finds all symbols connected to the given location.
19
19
  - *findDocumentSymbols* provides all symbols in the given document
20
20
  - *doCodeActions* evaluates code actions for the given location, typically to fix a problem.
21
- - *findColorSymbols* evaluates all color symbols in the given document
21
+ - *findDocumentColors* evaluates all color symbols in the given document
22
22
  - *doRename* renames all symbols connected to the given location.
23
23
  - *prepareRename* the range of the node that can be renamed
24
24
  - *getFoldingRanges* returns folding ranges in the given document.
@@ -1,5 +1,5 @@
1
1
  // copied from js-beautify/js/lib/beautify-css.js
2
- // version: 1.14.7
2
+ // version: 1.14.9
3
3
  /* AUTO-GENERATED. DO NOT MODIFY. */
4
4
  /*
5
5
 
@@ -1076,18 +1076,18 @@ function Beautifier(source_text, options) {
1076
1076
 
1077
1077
  // https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
1078
1078
  this.NESTED_AT_RULE = {
1079
- "@page": true,
1080
- "@font-face": true,
1081
- "@keyframes": true,
1079
+ "page": true,
1080
+ "font-face": true,
1081
+ "keyframes": true,
1082
1082
  // also in CONDITIONAL_GROUP_RULE below
1083
- "@media": true,
1084
- "@supports": true,
1085
- "@document": true
1083
+ "media": true,
1084
+ "supports": true,
1085
+ "document": true
1086
1086
  };
1087
1087
  this.CONDITIONAL_GROUP_RULE = {
1088
- "@media": true,
1089
- "@supports": true,
1090
- "@document": true
1088
+ "media": true,
1089
+ "supports": true,
1090
+ "document": true
1091
1091
  };
1092
1092
  this.NON_SEMICOLON_NEWLINE_PROPERTY = [
1093
1093
  "grid-template-areas",
@@ -1215,8 +1215,7 @@ Beautifier.prototype.beautify = function() {
1215
1215
  // label { content: blue }
1216
1216
  var insidePropertyValue = false;
1217
1217
  var enteringConditionalGroup = false;
1218
- var insideAtExtend = false;
1219
- var insideAtImport = false;
1218
+ var insideNonNestedAtRule = false;
1220
1219
  var insideScssMap = false;
1221
1220
  var topCharacter = this._ch;
1222
1221
  var insideNonSemiColonValues = false;
@@ -1271,10 +1270,32 @@ Beautifier.prototype.beautify = function() {
1271
1270
 
1272
1271
  // Ensures any new lines following the comment are preserved
1273
1272
  this.eatWhitespace(true);
1274
- } else if (this._ch === '@' || this._ch === '$') {
1273
+ } else if (this._ch === '$') {
1275
1274
  this.preserveSingleSpace(isAfterSpace);
1276
1275
 
1277
- // deal with less propery mixins @{...}
1276
+ this.print_string(this._ch);
1277
+
1278
+ // strip trailing space, if present, for hash property checks
1279
+ var variable = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
1280
+
1281
+ if (variable.match(/[ :]$/)) {
1282
+ // we have a variable or pseudo-class, add it and insert one space before continuing
1283
+ variable = this.eatString(": ").replace(/\s$/, '');
1284
+ this.print_string(variable);
1285
+ this._output.space_before_token = true;
1286
+ }
1287
+
1288
+ variable = variable.replace(/\s$/, '');
1289
+
1290
+ // might be sass variable
1291
+ if (parenLevel === 0 && variable.indexOf(':') !== -1) {
1292
+ insidePropertyValue = true;
1293
+ this.indent();
1294
+ }
1295
+ } else if (this._ch === '@') {
1296
+ this.preserveSingleSpace(isAfterSpace);
1297
+
1298
+ // deal with less property mixins @{...}
1278
1299
  if (this._input.peek() === '{') {
1279
1300
  this.print_string(this._ch + this.eatString('}'));
1280
1301
  } else {
@@ -1292,22 +1313,21 @@ Beautifier.prototype.beautify = function() {
1292
1313
 
1293
1314
  variableOrRule = variableOrRule.replace(/\s$/, '');
1294
1315
 
1295
- if (variableOrRule === 'extend') {
1296
- insideAtExtend = true;
1297
- } else if (variableOrRule === 'import') {
1298
- insideAtImport = true;
1299
- }
1316
+ // might be less variable
1317
+ if (parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
1318
+ insidePropertyValue = true;
1319
+ this.indent();
1300
1320
 
1301
- // might be a nesting at-rule
1302
- if (variableOrRule in this.NESTED_AT_RULE) {
1321
+ // might be a nesting at-rule
1322
+ } else if (variableOrRule in this.NESTED_AT_RULE) {
1303
1323
  this._nestedLevel += 1;
1304
1324
  if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
1305
1325
  enteringConditionalGroup = true;
1306
1326
  }
1307
- // might be less variable
1308
- } else if (!insideRule && parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
1309
- insidePropertyValue = true;
1310
- this.indent();
1327
+
1328
+ // might be a non-nested at-rule
1329
+ } else if (parenLevel === 0 && !insidePropertyValue) {
1330
+ insideNonNestedAtRule = true;
1311
1331
  }
1312
1332
  }
1313
1333
  } else if (this._ch === '#' && this._input.peek() === '{') {
@@ -1319,6 +1339,9 @@ Beautifier.prototype.beautify = function() {
1319
1339
  this.outdent();
1320
1340
  }
1321
1341
 
1342
+ // non nested at rule becomes nested
1343
+ insideNonNestedAtRule = false;
1344
+
1322
1345
  // when entering conditional groups, only rulesets are allowed
1323
1346
  if (enteringConditionalGroup) {
1324
1347
  enteringConditionalGroup = false;
@@ -1359,8 +1382,7 @@ Beautifier.prototype.beautify = function() {
1359
1382
  if (previous_ch === '{') {
1360
1383
  this._output.trim(true);
1361
1384
  }
1362
- insideAtImport = false;
1363
- insideAtExtend = false;
1385
+
1364
1386
  if (insidePropertyValue) {
1365
1387
  this.outdent();
1366
1388
  insidePropertyValue = false;
@@ -1394,9 +1416,10 @@ Beautifier.prototype.beautify = function() {
1394
1416
  }
1395
1417
  }
1396
1418
 
1397
- if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
1419
+ if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideNonNestedAtRule && parenLevel === 0) {
1398
1420
  // 'property: value' delimiter
1399
1421
  // which could be in a conditional group query
1422
+
1400
1423
  this.print_string(':');
1401
1424
  if (!insidePropertyValue) {
1402
1425
  insidePropertyValue = true;
@@ -1433,8 +1456,7 @@ Beautifier.prototype.beautify = function() {
1433
1456
  this.outdent();
1434
1457
  insidePropertyValue = false;
1435
1458
  }
1436
- insideAtExtend = false;
1437
- insideAtImport = false;
1459
+ insideNonNestedAtRule = false;
1438
1460
  this.print_string(this._ch);
1439
1461
  this.eatWhitespace(true);
1440
1462
 
@@ -1499,7 +1521,7 @@ Beautifier.prototype.beautify = function() {
1499
1521
  } else if (this._ch === ',') {
1500
1522
  this.print_string(this._ch);
1501
1523
  this.eatWhitespace(true);
1502
- if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
1524
+ if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideNonNestedAtRule) {
1503
1525
  this._output.add_new_line();
1504
1526
  } else {
1505
1527
  this._output.space_before_token = true;
@@ -127,6 +127,7 @@ export interface IPropertyData {
127
127
  values?: IValueData[];
128
128
  references?: IReference[];
129
129
  relevance?: number;
130
+ atRule?: string;
130
131
  }
131
132
  export interface IAtDirectiveData {
132
133
  name: string;