feat(prettier) print while statement (#1387)

This commit is contained in:
Cameron 2023-11-17 17:52:27 +00:00 committed by GitHub
parent 0195affb5a
commit 5cb6ff2895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -228,7 +228,16 @@ impl<'a> Format<'a> for ForStatementLeft<'a> {
impl<'a> Format<'a> for WhileStatement<'a> {
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
Doc::Line
let mut parts = p.vec();
parts.push(ss!("while ("));
parts.push(group!(p, indent!(p, softline!(), format!(p, self.test), softline!())));
parts.push(ss!(")"));
parts.push(format!(p, self.body));
Doc::Group(parts)
}
}