vscode-css-languageservice
Advanced tools
Comparing version 5.4.1 to 5.4.2
// copied from js-beautify/js/lib/beautify-css.js | ||
// version: 1.14.2 | ||
// version: 1.14.3 | ||
/* AUTO-GENERATED. DO NOT MODIFY. */ | ||
@@ -1092,2 +1092,5 @@ /* | ||
}; | ||
this.NON_SEMICOLON_NEWLINE_PROPERTY = [ | ||
"grid-template" | ||
]; | ||
@@ -1217,3 +1220,5 @@ } | ||
var insideAtImport = false; | ||
var insideScssMap = false; | ||
var topCharacter = this._ch; | ||
var insideNonSemiColonValues = false; | ||
var whitespace; | ||
@@ -1270,3 +1275,3 @@ var isAfterSpace; | ||
this.eatWhitespace(true); | ||
} else if (this._ch === '@') { | ||
} else if (this._ch === '@' || this._ch === '$') { | ||
this.preserveSingleSpace(isAfterSpace); | ||
@@ -1342,3 +1347,8 @@ | ||
} else { | ||
this.indent(); | ||
// inside mixin and first param is object | ||
if (previous_ch === '(') { | ||
this._output.space_before_token = false; | ||
} else if (previous_ch !== ',') { | ||
this.indent(); | ||
} | ||
this.print_string(this._ch); | ||
@@ -1375,3 +1385,17 @@ } | ||
} | ||
if (this._input.peek() === ')') { | ||
this._output.trim(true); | ||
if (this._options.brace_style === "expand") { | ||
this._output.add_new_line(true); | ||
} | ||
} | ||
} else if (this._ch === ":") { | ||
for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) { | ||
if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) { | ||
insideNonSemiColonValues = true; | ||
break; | ||
} | ||
} | ||
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) { | ||
@@ -1409,2 +1433,3 @@ // 'property: value' delimiter | ||
} else if (this._ch === ';') { | ||
insideNonSemiColonValues = false; | ||
if (parenLevel === 0) { | ||
@@ -1451,5 +1476,12 @@ if (insidePropertyValue) { | ||
this.print_string(this._ch); | ||
this.eatWhitespace(); | ||
parenLevel++; | ||
this.indent(); | ||
// handle scss/sass map | ||
if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) { | ||
this._output.add_new_line(); | ||
insideScssMap = true; | ||
} else { | ||
this.eatWhitespace(); | ||
parenLevel++; | ||
this.indent(); | ||
} | ||
} | ||
@@ -1461,2 +1493,7 @@ } else if (this._ch === ')') { | ||
} | ||
if (insideScssMap && this._input.peek() === ";" && this._options.selector_separator_newline) { | ||
insideScssMap = false; | ||
this.outdent(); | ||
this._output.add_new_line(); | ||
} | ||
this.print_string(this._ch); | ||
@@ -1466,3 +1503,3 @@ } else if (this._ch === ',') { | ||
this.eatWhitespace(true); | ||
if (this._options.selector_separator_newline && !insidePropertyValue && parenLevel === 0 && !insideAtImport && !insideAtExtend) { | ||
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) { | ||
this._output.add_new_line(); | ||
@@ -1501,4 +1538,9 @@ } else { | ||
} else { | ||
this.preserveSingleSpace(isAfterSpace); | ||
var preserveAfterSpace = previous_ch === '"' || previous_ch === '\''; | ||
this.preserveSingleSpace(preserveAfterSpace || isAfterSpace); | ||
this.print_string(this._ch); | ||
if (!this._output.just_added_newline() && this._input.peek() === '\n' && insideNonSemiColonValues) { | ||
this._output.add_new_line(); | ||
} | ||
} | ||
@@ -1505,0 +1547,0 @@ } |
@@ -387,3 +387,3 @@ /*--------------------------------------------------------------------------------------------- | ||
specificity.tag++; // pseudo element | ||
break; | ||
continue elementLoop; | ||
} | ||
@@ -435,3 +435,3 @@ // where and child selectors have zero specificity | ||
specificity.attr++; //pseudo class | ||
break; | ||
continue elementLoop; | ||
} | ||
@@ -438,0 +438,0 @@ if (element.getChildren().length > 0) { |
// copied from js-beautify/js/lib/beautify-css.js | ||
// version: 1.14.2 | ||
// version: 1.14.3 | ||
/* AUTO-GENERATED. DO NOT MODIFY. */ | ||
@@ -1095,2 +1095,5 @@ /* | ||
}; | ||
this.NON_SEMICOLON_NEWLINE_PROPERTY = [ | ||
"grid-template" | ||
]; | ||
@@ -1220,3 +1223,5 @@ } | ||
var insideAtImport = false; | ||
var insideScssMap = false; | ||
var topCharacter = this._ch; | ||
var insideNonSemiColonValues = false; | ||
var whitespace; | ||
@@ -1273,3 +1278,3 @@ var isAfterSpace; | ||
this.eatWhitespace(true); | ||
} else if (this._ch === '@') { | ||
} else if (this._ch === '@' || this._ch === '$') { | ||
this.preserveSingleSpace(isAfterSpace); | ||
@@ -1345,3 +1350,8 @@ | ||
} else { | ||
this.indent(); | ||
// inside mixin and first param is object | ||
if (previous_ch === '(') { | ||
this._output.space_before_token = false; | ||
} else if (previous_ch !== ',') { | ||
this.indent(); | ||
} | ||
this.print_string(this._ch); | ||
@@ -1378,3 +1388,17 @@ } | ||
} | ||
if (this._input.peek() === ')') { | ||
this._output.trim(true); | ||
if (this._options.brace_style === "expand") { | ||
this._output.add_new_line(true); | ||
} | ||
} | ||
} else if (this._ch === ":") { | ||
for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) { | ||
if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) { | ||
insideNonSemiColonValues = true; | ||
break; | ||
} | ||
} | ||
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) { | ||
@@ -1412,2 +1436,3 @@ // 'property: value' delimiter | ||
} else if (this._ch === ';') { | ||
insideNonSemiColonValues = false; | ||
if (parenLevel === 0) { | ||
@@ -1454,5 +1479,12 @@ if (insidePropertyValue) { | ||
this.print_string(this._ch); | ||
this.eatWhitespace(); | ||
parenLevel++; | ||
this.indent(); | ||
// handle scss/sass map | ||
if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) { | ||
this._output.add_new_line(); | ||
insideScssMap = true; | ||
} else { | ||
this.eatWhitespace(); | ||
parenLevel++; | ||
this.indent(); | ||
} | ||
} | ||
@@ -1464,2 +1496,7 @@ } else if (this._ch === ')') { | ||
} | ||
if (insideScssMap && this._input.peek() === ";" && this._options.selector_separator_newline) { | ||
insideScssMap = false; | ||
this.outdent(); | ||
this._output.add_new_line(); | ||
} | ||
this.print_string(this._ch); | ||
@@ -1469,3 +1506,3 @@ } else if (this._ch === ',') { | ||
this.eatWhitespace(true); | ||
if (this._options.selector_separator_newline && !insidePropertyValue && parenLevel === 0 && !insideAtImport && !insideAtExtend) { | ||
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) { | ||
this._output.add_new_line(); | ||
@@ -1504,4 +1541,9 @@ } else { | ||
} else { | ||
this.preserveSingleSpace(isAfterSpace); | ||
var preserveAfterSpace = previous_ch === '"' || previous_ch === '\''; | ||
this.preserveSingleSpace(preserveAfterSpace || isAfterSpace); | ||
this.print_string(this._ch); | ||
if (!this._output.just_added_newline() && this._input.peek() === '\n' && insideNonSemiColonValues) { | ||
this._output.add_new_line(); | ||
} | ||
} | ||
@@ -1508,0 +1550,0 @@ } |
@@ -399,3 +399,3 @@ var __extends = (this && this.__extends) || (function () { | ||
specificity.tag++; // pseudo element | ||
break; | ||
continue elementLoop; | ||
} | ||
@@ -447,3 +447,3 @@ // where and child selectors have zero specificity | ||
specificity.attr++; //pseudo class | ||
break; | ||
continue elementLoop; | ||
} | ||
@@ -450,0 +450,0 @@ if (element.getChildren().length > 0) { |
{ | ||
"name": "vscode-css-languageservice", | ||
"version": "5.4.1", | ||
"version": "5.4.2", | ||
"description": "Language service for CSS, LESS and SCSS", | ||
@@ -24,3 +24,3 @@ "main": "./lib/umd/cssLanguageService.js", | ||
"eslint": "^8.11.0", | ||
"js-beautify": "^1.14.2", | ||
"js-beautify": "^1.14.3", | ||
"mocha": "^9.2.2", | ||
@@ -27,0 +27,0 @@ "rimraf": "^3.0.2", |
@@ -55,2 +55,3 @@ # vscode-css-languageservice | ||
- run VSCode out of sources setup as described here: https://github.com/Microsoft/vscode/wiki/How-to-Contribute | ||
- run `yarn link` in the folder of `vscode-css-languageservice` | ||
- use `yarn link vscode-css-languageservice` in `vscode/extensions/css-language-features/server` to run VSCode with the latest changes from `vscode-css-languageservice` | ||
@@ -57,0 +58,0 @@ - run VSCode out of source (`vscode/scripts/code.sh|bat`) and open a `.css` file |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3099166
72953
77