Fix formatting of lists in SCSS property/variable values (#5710)

master
Jarda Snajdr 2019-01-09 17:08:34 +01:00 committed by Ika
parent e83490a90e
commit 5847c168e4
3 changed files with 15 additions and 12 deletions

View File

@ -625,19 +625,9 @@ function genericPrint(path, options, print) {
continue;
}
// Ignore inline comment, they already contain newline at end (i.e. `// Comment`)
// Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
const isInlineComment = isInlineValueCommentNode(iNode);
if (
(iPrevNode && isInlineValueCommentNode(iPrevNode)) ||
isInlineComment ||
isInlineValueCommentNode(iNextNode)
) {
if (isInlineComment) {
parts.push(hardline);
}
if (isInlineValueCommentNode(iNode)) {
parts.push(hardline);
continue;
}

View File

@ -699,11 +699,19 @@ $my-list:
'foo', // Foo
'bar'; // Bar
$my-list2:
a // a
b
c;
=====================================output=====================================
$my-list: "foo",
// Foo
"bar"; // Bar
$my-list2: a // a
b c;
================================================================================
`;

View File

@ -1,3 +1,8 @@
$my-list:
'foo', // Foo
'bar'; // Bar
$my-list2:
a // a
b
c;