mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 04:57:44 +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()
|
build_ctx.config.layout()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// (
|
||||||
let child = children.get_next().unwrap();
|
let child = children.get_next().unwrap();
|
||||||
steps.push_back(crate::builder::Step::Format(child.element));
|
steps.push_back(crate::builder::Step::Format(child.element));
|
||||||
match layout {
|
match layout {
|
||||||
crate::config::Layout::Tall => {
|
crate::config::Layout::Tall => {
|
||||||
steps.push_back(crate::builder::Step::Indent);
|
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| {
|
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::NewLine);
|
||||||
steps.push_back(crate::builder::Step::Pad);
|
steps.push_back(crate::builder::Step::Pad);
|
||||||
|
steps.push_back(crate::builder::Step::Comment(text));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// expr
|
||||||
let child = children.get_next().unwrap();
|
let child = children.get_next().unwrap();
|
||||||
match layout {
|
match layout {
|
||||||
crate::config::Layout::Tall => {
|
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));
|
steps.push_back(crate::builder::Step::FormatWider(child.element));
|
||||||
}
|
}
|
||||||
crate::config::Layout::Wide => {
|
crate::config::Layout::Wide => {
|
||||||
|
steps.push_back(crate::builder::Step::Whitespace);
|
||||||
steps.push_back(crate::builder::Step::Format(child.element));
|
steps.push_back(crate::builder::Step::Format(child.element));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**/
|
||||||
children.drain_comments(|text| {
|
children.drain_comments(|text| {
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
steps.push_back(crate::builder::Step::Pad);
|
steps.push_back(crate::builder::Step::Pad);
|
||||||
steps.push_back(crate::builder::Step::Comment(text));
|
steps.push_back(crate::builder::Step::Comment(text));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// )
|
||||||
let child = children.get_next().unwrap();
|
let child = children.get_next().unwrap();
|
||||||
match layout {
|
match layout {
|
||||||
crate::config::Layout::Tall => {
|
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 @@
|
||||||
(
|
(
|
||||||
/*
|
( ( c ) )
|
||||||
a
|
(
|
||||||
*/
|
( c )
|
||||||
(
|
/*
|
||||||
/*
|
e
|
||||||
b
|
*/
|
||||||
*/
|
)
|
||||||
( c )
|
(
|
||||||
)
|
(
|
||||||
/*
|
c
|
||||||
d
|
/*
|
||||||
*/
|
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