mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Format multiline reecord builder fields nicely
This commit is contained in:
parent
5edcb31f32
commit
4cd2c957ca
2 changed files with 69 additions and 5 deletions
|
@ -1544,8 +1544,15 @@ fn format_record_builder_field_multiline(
|
|||
|
||||
buf.push_str(separator_prefix);
|
||||
buf.push_str(":");
|
||||
buf.spaces(1);
|
||||
ann.value.format(buf, indent);
|
||||
|
||||
if ann.value.is_multiline() {
|
||||
buf.newline();
|
||||
ann.value.format(buf, indent + INDENT);
|
||||
} else {
|
||||
buf.spaces(1);
|
||||
ann.value.format(buf, indent);
|
||||
}
|
||||
|
||||
buf.push(',');
|
||||
}
|
||||
ApplyValue(name, colon_spaces, arrow_spaces, ann) => {
|
||||
|
@ -1564,13 +1571,18 @@ fn format_record_builder_field_multiline(
|
|||
|
||||
if !arrow_spaces.is_empty() {
|
||||
fmt_spaces(buf, arrow_spaces.iter(), indent);
|
||||
buf.indent(indent);
|
||||
buf.indent(indent + INDENT);
|
||||
}
|
||||
|
||||
buf.push_str("<-");
|
||||
buf.spaces(1);
|
||||
|
||||
ann.value.format(buf, indent);
|
||||
if ann.value.is_multiline() {
|
||||
buf.newline();
|
||||
ann.value.format(buf, indent + INDENT);
|
||||
} else {
|
||||
buf.spaces(1);
|
||||
ann.value.format(buf, indent);
|
||||
}
|
||||
buf.push(',');
|
||||
}
|
||||
LabelOnly(name) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue