mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Special-case records, lists, functions in def fmt
This commit is contained in:
parent
8178f22ce4
commit
2be68189b4
1 changed files with 13 additions and 0 deletions
|
@ -348,6 +348,19 @@ pub fn fmt_body<'a, 'buf>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Expr::Record { .. } | Expr::List { .. } | Expr::Closure(_, _) => {
|
||||||
|
if body.is_multiline() {
|
||||||
|
buf.spaces(1);
|
||||||
|
body.format_with_options(buf, Parens::NotNeeded, Newlines::Yes, indent);
|
||||||
|
} else {
|
||||||
|
body.format_with_options(
|
||||||
|
buf,
|
||||||
|
Parens::NotNeeded,
|
||||||
|
Newlines::Yes,
|
||||||
|
indent + INDENT,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Expr::BinOps(_, _) => {
|
Expr::BinOps(_, _) => {
|
||||||
// Binop chains always get a newline. Otherwise you can have things like:
|
// Binop chains always get a newline. Otherwise you can have things like:
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue