mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 04:57:44 +00:00
feat: paren without max-width
This commit is contained in:
parent
94bc85ced1
commit
5658798276
2 changed files with 21 additions and 11 deletions
|
@ -4,9 +4,11 @@ pub fn rule(
|
||||||
) -> std::collections::LinkedList<crate::builder::Step> {
|
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||||
let mut steps = std::collections::LinkedList::new();
|
let mut steps = std::collections::LinkedList::new();
|
||||||
|
|
||||||
let mut children = crate::children::Children::new(build_ctx, node);
|
let mut children = crate::children::Children::new_with_configuration(
|
||||||
|
build_ctx, node, true,
|
||||||
|
);
|
||||||
|
|
||||||
let layout = if children.has_comments() {
|
let layout = if children.has_comments() || children.has_newlines() {
|
||||||
&crate::config::Layout::Tall
|
&crate::config::Layout::Tall
|
||||||
} else {
|
} else {
|
||||||
build_ctx.config.layout()
|
build_ctx.config.layout()
|
||||||
|
@ -23,10 +25,13 @@ pub fn rule(
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**/
|
// /**/
|
||||||
children.drain_comments(|text| {
|
children.drain_comments_and_newlines(|element| match element {
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||||
steps.push_back(crate::builder::Step::Pad);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
steps.push_back(crate::builder::Step::Comment(text));
|
steps.push_back(crate::builder::Step::Pad);
|
||||||
|
steps.push_back(crate::builder::Step::Comment(text));
|
||||||
|
}
|
||||||
|
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
// expr
|
// expr
|
||||||
|
@ -43,10 +48,13 @@ pub fn rule(
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**/
|
// /**/
|
||||||
children.drain_comments(|text| {
|
children.drain_comments_and_newlines(|element| match element {
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||||
steps.push_back(crate::builder::Step::Pad);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
steps.push_back(crate::builder::Step::Comment(text));
|
steps.push_back(crate::builder::Step::Pad);
|
||||||
|
steps.push_back(crate::builder::Step::Comment(text));
|
||||||
|
}
|
||||||
|
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
// )
|
// )
|
||||||
|
|
|
@ -47,7 +47,9 @@
|
||||||
*/
|
*/
|
||||||
d
|
d
|
||||||
)
|
)
|
||||||
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
|
(
|
||||||
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
)
|
||||||
(
|
(
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue