Skip to content

Commit

Permalink
fix indent when formatting Sass @each
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Jun 17, 2024
1 parent 494fb90 commit 1ea42d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
6 changes: 5 additions & 1 deletion malva/src/doc_gen/sass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ impl<'s> DocGen<'s> for SassEach<'s> {
.append(Doc::text("in"))
.append(helpers::format_operator_suffix_space(ctx))
.concat(ctx.end_spaced_comments(self.in_span.end, self.expr.span().start))
.append(self.expr.doc(ctx))
.append(if matches!(self.expr, ComponentValue::SassList(..)) {
self.expr.doc(ctx)
} else {
self.expr.doc(ctx).nest(ctx.indent_width)
})
.group()
}
}
Expand Down
24 changes: 12 additions & 12 deletions malva/tests/fmt/scss/at-rule/each.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ source: malva/tests/fmt.rs
@each $element, $size in (h1: 20px, h2: 16px, h3: 14px) {}
@each $element, $size in
(
h1: 20px,
h2: 16px,
h3: 14px
) {}
h1: 20px,
h2: 16px,
h3: 14px
) {}
@each $element, $size in
(
h1: 20px,
h2: 16px,
h3: 14px
) {}
h1: 20px,
h2: 16px,
h3: 14px
) {}
@each $element, $size in
(
h1: 20px,
h2: 16px,
h3: 14px
) {}
h1: 20px,
h2: 16px,
h3: 14px
) {}

0 comments on commit 1ea42d6

Please sign in to comment.