Fix: [Sass] Unexpectedly add extra space after function when passing arbitrary arguments (#8567)

Co-authored-by: Boyen Vaesen <boyen.vaesen@kbc.be>
This commit is contained in:
Boyen VaesenandBoyen Vaesen authored and GitHub committed 2020-06-17 09:26:28 +08:00
1 parent 29959103a9
commit aefc9a48e5
4 files changed
+206

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
#### Fix: [Sass] Unexpectedly add extra space after function when passing arbitrary arguments ([#8567](https://github.com/prettier/prettier/pull/8567) by [@boyenn](https://github.com/boyenn))
<!-- prettier-ignore -->
```css
/* Input */
body {
test: function($list...);
test: function(return-list($list)...);
}
/* Prettier stable */
body {
test: function($list...);
test: function(return-list($list) ...);
}
/* Prettier master */
body {
test: function($list...);
test: function(return-list($list)...);
}
```
+4
View File
@@ -777,6 +777,10 @@ function genericPrint(path, options, print) {
continue;
}
// allow function(returns-list($list)...)
if (iNextNode && iNextNode.value === "...") {
continue;
}
// Be default all values go through `line`
parts.push(line);
@@ -1,5 +1,154 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`arbitrary-arguments.scss - {"trailingComma":"none"} format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
trailingComma: "none"
| printWidth
=====================================input======================================
body {
test: foo(return-list($list)...);
}
body {
test: foo(bar($list)...);
}
body {
test: foo($list...);
}
@mixin syntax-colors($args...) {
@debug meta.keywords($args);
// (string: #080, comment: #800, variable: $60b)
@each $name, $color in meta.keywords($args) {
pre span.stx-#{$name} {
color: $color;
}
}
}
$form-selectors: "input.name", "input.address", "input.zip" !default;
@include order(150px, $form-selectors...);
@mixin linear-gradient($direction, $gradients...) {
background-color: nth($gradients, 1);
background-image: linear-gradient($direction, $gradients...);
}
$parameters: (
'c': 'kittens',
'a': true,
'b': 42
);
$value: dummy($parameters...);
=====================================output=====================================
body {
test: foo(return-list($list)...);
}
body {
test: foo(bar($list)...);
}
body {
test: foo($list...);
}
@mixin syntax-colors($args...) {
@debug meta.keywords($args);
// (string: #080, comment: #800, variable: $60b)
@each $name, $color in meta.keywords($args) {
pre span.stx-#{$name} {
color: $color;
}
}
}
$form-selectors: "input.name", "input.address", "input.zip" !default;
@include order(150px, $form-selectors...);
@mixin linear-gradient($direction, $gradients...) {
background-color: nth($gradients, 1);
background-image: linear-gradient($direction, $gradients...);
}
$parameters: (
"c": "kittens",
"a": true,
"b": 42
);
$value: dummy($parameters...);
================================================================================
`;
exports[`arbitrary-arguments.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
| printWidth
=====================================input======================================
body {
test: foo(return-list($list)...);
}
body {
test: foo(bar($list)...);
}
body {
test: foo($list...);
}
@mixin syntax-colors($args...) {
@debug meta.keywords($args);
// (string: #080, comment: #800, variable: $60b)
@each $name, $color in meta.keywords($args) {
pre span.stx-#{$name} {
color: $color;
}
}
}
$form-selectors: "input.name", "input.address", "input.zip" !default;
@include order(150px, $form-selectors...);
@mixin linear-gradient($direction, $gradients...) {
background-color: nth($gradients, 1);
background-image: linear-gradient($direction, $gradients...);
}
$parameters: (
'c': 'kittens',
'a': true,
'b': 42
);
$value: dummy($parameters...);
=====================================output=====================================
body {
test: foo(return-list($list)...);
}
body {
test: foo(bar($list)...);
}
body {
test: foo($list...);
}
@mixin syntax-colors($args...) {
@debug meta.keywords($args);
// (string: #080, comment: #800, variable: $60b)
@each $name, $color in meta.keywords($args) {
pre span.stx-#{$name} {
color: $color;
}
}
}
$form-selectors: "input.name", "input.address", "input.zip" !default;
@include order(150px, $form-selectors...);
@mixin linear-gradient($direction, $gradients...) {
background-color: nth($gradients, 1);
background-image: linear-gradient($direction, $gradients...);
}
$parameters: (
"c": "kittens",
"a": true,
"b": 42,
);
$value: dummy($parameters...);
================================================================================
`;
exports[`comments.scss - {"trailingComma":"none"} format 1`] = `
====================================options=====================================
parsers: ["scss"]
+31
View File
@@ -0,0 +1,31 @@
body {
test: foo(return-list($list)...);
}
body {
test: foo(bar($list)...);
}
body {
test: foo($list...);
}
@mixin syntax-colors($args...) {
@debug meta.keywords($args);
// (string: #080, comment: #800, variable: $60b)
@each $name, $color in meta.keywords($args) {
pre span.stx-#{$name} {
color: $color;
}
}
}
$form-selectors: "input.name", "input.address", "input.zip" !default;
@include order(150px, $form-selectors...);
@mixin linear-gradient($direction, $gradients...) {
background-color: nth($gradients, 1);
background-image: linear-gradient($direction, $gradients...);
}
$parameters: (
'c': 'kittens',
'a': true,
'b': 42
);
$value: dummy($parameters...);