Add space before unary minus followed by a function call. (#15129)
This commit is contained in:
1 parent
24dfe5afe7
commit
5b38f6ec4f
4 files changed
+53
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#### Add space before unary minus followed by a function call (#15129 by @pamelalozano)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```less
|
||||
// Input
|
||||
div {
|
||||
margin: - func();
|
||||
}
|
||||
|
||||
// Prettier stable
|
||||
div {
|
||||
margin: -func();
|
||||
}
|
||||
|
||||
// Prettier main
|
||||
div {
|
||||
margin: - func();
|
||||
}
|
||||
```
|
||||
@@ -264,6 +264,17 @@ function printCommaSeparatedValueGroup(path, options, print) {
|
||||
iPrevNode?.type === "value-func" ||
|
||||
(iPrevNode && isWordNode(iPrevNode));
|
||||
|
||||
// Space before unary minus followed by a function call.
|
||||
if (
|
||||
options.parser === "scss" &&
|
||||
isMathOperator &&
|
||||
iNode.value === "-" &&
|
||||
iNextNode.type === "value-func"
|
||||
) {
|
||||
parts.push(" ");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Formatting `/`, `+`, `-` sign
|
||||
if (
|
||||
!(isMultiplicationNode(iNextNode) || isMultiplicationNode(iNode)) &&
|
||||
|
||||
@@ -1554,6 +1554,10 @@ label {
|
||||
pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, 2))))))))))))
|
||||
}
|
||||
|
||||
// #5636
|
||||
div {
|
||||
margin: - pow(2, 2) * 100px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
@media #{$g-breakpoint-tiny} {
|
||||
}
|
||||
@@ -2622,6 +2626,11 @@ label {
|
||||
);
|
||||
}
|
||||
|
||||
// #5636
|
||||
div {
|
||||
margin: - pow(2, 2) * 100px;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
@@ -3719,6 +3728,10 @@ label {
|
||||
pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, 2))))))))))))
|
||||
}
|
||||
|
||||
// #5636
|
||||
div {
|
||||
margin: - pow(2, 2) * 100px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
@media #{$g-breakpoint-tiny} {
|
||||
}
|
||||
@@ -4787,6 +4800,11 @@ label {
|
||||
);
|
||||
}
|
||||
|
||||
// #5636
|
||||
div {
|
||||
margin: - pow(2, 2) * 100px;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
|
||||
@@ -1084,3 +1084,8 @@ label {
|
||||
// This next pow is really powerful
|
||||
pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, pow(2, 2))))))))))))
|
||||
}
|
||||
|
||||
// #5636
|
||||
div {
|
||||
margin: - pow(2, 2) * 100px;
|
||||
}
|
||||
Reference in new issue
Block a user