1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-31 12:37:45 +00:00

feat: case expression

This commit is contained in:
Kevin Amado 2022-01-30 23:55:55 -05:00
parent 658f5e25db
commit 0f5e67f509
No known key found for this signature in database
GPG key ID: FFF341057F503148
3 changed files with 37 additions and 0 deletions

View file

@ -41,6 +41,13 @@ pub fn rule(
steps.push_back(crate::builder::Step::FormatWider(
child.element,
));
} else if branch == "else"
&& child.element.kind() == rnix::SyntaxKind::NODE_IF_ELSE
{
steps.push_back(crate::builder::Step::Whitespace);
steps.push_back(crate::builder::Step::FormatWider(
child.element,
));
} else {
steps.push_back(crate::builder::Step::Indent);
steps.push_back(crate::builder::Step::NewLine);

View file

@ -1,6 +1,8 @@
[
(if ./a then b else c)
(if /**/ a /**/ then /**/ b /**/ else /**/ c)
(if if a then b else c then b else if a then b else if a then b else c)
(if if a then b else c then b else if a then b else /*x*/ if a then b else c)
(if
(if
(if

View file

@ -17,6 +17,34 @@
/**/
c
)
(
if
if a
then b
else c
then b
else if a
then b
else if a
then b
else c
)
(
if
if a
then b
else c
then b
else if a
then b
else
/*
x
*/
if a
then b
else c
)
(
if
(