mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 12:37:45 +00:00
feat: increase paren coverage
This commit is contained in:
parent
56ed74357c
commit
5ffcf04579
3 changed files with 194 additions and 19 deletions
|
@ -12,41 +12,45 @@ pub fn rule(
|
|||
build_ctx.config.layout()
|
||||
};
|
||||
|
||||
// (
|
||||
let child = children.get_next().unwrap();
|
||||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
match layout {
|
||||
crate::config::Layout::Tall => {
|
||||
steps.push_back(crate::builder::Step::Indent);
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
}
|
||||
crate::config::Layout::Wide => {
|
||||
steps.push_back(crate::builder::Step::Whitespace);
|
||||
}
|
||||
crate::config::Layout::Wide => {}
|
||||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
});
|
||||
|
||||
// expr
|
||||
let child = children.get_next().unwrap();
|
||||
match layout {
|
||||
crate::config::Layout::Tall => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::FormatWider(child.element));
|
||||
}
|
||||
crate::config::Layout::Wide => {
|
||||
steps.push_back(crate::builder::Step::Whitespace);
|
||||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
}
|
||||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
});
|
||||
|
||||
// )
|
||||
let child = children.get_next().unwrap();
|
||||
match layout {
|
||||
crate::config::Layout::Tall => {
|
||||
|
|
|
@ -1 +1,18 @@
|
|||
(/*a*/(/*b*/(c))/*d*/)
|
||||
(
|
||||
( ( c ) )
|
||||
( ( c )/*e*/)
|
||||
( ( c/*d*/) )
|
||||
( ( c/*d*/)/*e*/)
|
||||
( (/*b*/c ) )
|
||||
( (/*b*/c )/*e*/)
|
||||
( (/*b*/c/*d*/) )
|
||||
( (/*b*/c/*d*/)/*e*/)
|
||||
(/*a*/( c ) )
|
||||
(/*a*/( c )/*e*/)
|
||||
(/*a*/( c/*d*/) )
|
||||
(/*a*/( c/*d*/)/*e*/)
|
||||
(/*a*/(/*b*/c ) )
|
||||
(/*a*/(/*b*/c )/*e*/)
|
||||
(/*a*/(/*b*/c/*d*/) )
|
||||
(/*a*/(/*b*/c/*d*/)/*e*/)
|
||||
)
|
||||
|
|
|
@ -1,14 +1,168 @@
|
|||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
( c )
|
||||
)
|
||||
/*
|
||||
d
|
||||
*/
|
||||
( ( c ) )
|
||||
(
|
||||
( c )
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
(
|
||||
(
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
)
|
||||
(
|
||||
(
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
)
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
)
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
( c )
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
( c )
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
)
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
)
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
/*
|
||||
e
|
||||
*/
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue