Fix formatting of lists in SCSS property/variable values (#5710)
parent
e83490a90e
commit
5847c168e4
|
@ -625,19 +625,9 @@ function genericPrint(path, options, print) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore inline comment, they already contain newline at end (i.e. `// Comment`)
|
|
||||||
// Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
|
// Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
|
||||||
const isInlineComment = isInlineValueCommentNode(iNode);
|
if (isInlineValueCommentNode(iNode)) {
|
||||||
|
parts.push(hardline);
|
||||||
if (
|
|
||||||
(iPrevNode && isInlineValueCommentNode(iPrevNode)) ||
|
|
||||||
isInlineComment ||
|
|
||||||
isInlineValueCommentNode(iNextNode)
|
|
||||||
) {
|
|
||||||
if (isInlineComment) {
|
|
||||||
parts.push(hardline);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -699,11 +699,19 @@ $my-list:
|
||||||
'foo', // Foo
|
'foo', // Foo
|
||||||
'bar'; // Bar
|
'bar'; // Bar
|
||||||
|
|
||||||
|
$my-list2:
|
||||||
|
a // a
|
||||||
|
b
|
||||||
|
c;
|
||||||
|
|
||||||
=====================================output=====================================
|
=====================================output=====================================
|
||||||
$my-list: "foo",
|
$my-list: "foo",
|
||||||
// Foo
|
// Foo
|
||||||
"bar"; // Bar
|
"bar"; // Bar
|
||||||
|
|
||||||
|
$my-list2: a // a
|
||||||
|
b c;
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
$my-list:
|
$my-list:
|
||||||
'foo', // Foo
|
'foo', // Foo
|
||||||
'bar'; // Bar
|
'bar'; // Bar
|
||||||
|
|
||||||
|
$my-list2:
|
||||||
|
a // a
|
||||||
|
b
|
||||||
|
c;
|
||||||
|
|
Loading…
Reference in New Issue