Skip to content

Commit

Permalink
fix: fix extra whitespace in unknown at-rule (fix #23)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Jan 8, 2025
1 parent 65f72e4 commit f4cd8f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
14 changes: 2 additions & 12 deletions malva/src/doc_gen/token_seq.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
use super::DocGen;
use crate::{ctx::Ctx, state::State};
use raffia::{
ast::*,
token::{Token, TokenWithSpan},
Spanned,
};
use raffia::{ast::*, Spanned};
use tiny_pretty::Doc;

impl<'s> DocGen<'s> for TokenSeq<'s> {
Expand All @@ -17,13 +13,7 @@ impl<'s> DocGen<'s> for TokenSeq<'s> {
docs.extend(ctx.start_spaced_comments(ctx.get_comments_between(pos, span.start)));

docs.push(token.doc(ctx, state));
if let TokenWithSpan {
token: Token::Comma(..) | Token::Semicolon(..),
..
} = token
{
docs.push(Doc::soft_line());
} else if matches!(iter.peek(), Some(next) if token.span().end < next.span().start) {
if matches!(iter.peek(), Some(next) if token.span().end < next.span().start) {
docs.push(Doc::soft_line());
}

Expand Down
4 changes: 4 additions & 0 deletions malva/tests/fmt/css/tailwind/apply.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
@apply text-jsr-cyan-700 hover:text-jsr-cyan-900 underline decoration-jsr-cyan-700/50 underline-offset-2
outline-none focus-visible:ring-2 ring-jsr-cyan-700 ring-offset-2 rounded-sm;
}

.ease-custom {
@apply ease-[cubic-bezier(0.4,0,0.1,1)];
}
4 changes: 4 additions & 0 deletions malva/tests/fmt/css/tailwind/apply.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ source: malva/tests/fmt.rs
decoration-jsr-cyan-700/50 underline-offset-2 outline-none
focus-visible:ring-2 ring-jsr-cyan-700 ring-offset-2 rounded-sm;
}

.ease-custom {
@apply ease-[cubic-bezier(0.4,0,0.1,1)];
}

0 comments on commit f4cd8f5

Please sign in to comment.