mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(prettier): print blank lines when printing array concisely (#1600)
This commit is contained in:
parent
f4f392e19f
commit
deac95e274
1 changed files with 10 additions and 3 deletions
|
|
@ -1,12 +1,12 @@
|
|||
use oxc_ast::ast::*;
|
||||
use oxc_span::Span;
|
||||
use oxc_span::{GetSpan, Span};
|
||||
use oxc_syntax::operator::UnaryOperator;
|
||||
|
||||
use crate::{
|
||||
array,
|
||||
comments::DanglingCommentsPrintOptions,
|
||||
doc::{Doc, DocBuilder, Fill, Group},
|
||||
group, if_break, indent, line, softline, ss, Prettier,
|
||||
group, hardline, if_break, indent, line, softline, ss, Prettier,
|
||||
};
|
||||
|
||||
use super::Format;
|
||||
|
|
@ -212,7 +212,14 @@ where
|
|||
parts.push(part);
|
||||
|
||||
if !is_last {
|
||||
parts.push(line!());
|
||||
if p.is_next_line_empty_after_index(element.span().end) {
|
||||
let mut space_parts = p.vec();
|
||||
space_parts.extend(hardline!());
|
||||
space_parts.extend(hardline!());
|
||||
parts.push(Doc::Array(space_parts));
|
||||
} else {
|
||||
parts.push(line!());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue