mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Fixed the multiline dbg formatting
This commit is contained in:
parent
6a6d5cebc0
commit
7162fbddd3
3 changed files with 11 additions and 23 deletions
|
@ -305,22 +305,16 @@ fn should_outdent(mut rhs: &TypeAnnotation) -> bool {
|
|||
fn fmt_dbg_in_def<'a>(
|
||||
buf: &mut Buf,
|
||||
condition: &'a Loc<Expr<'a>>,
|
||||
is_multiline: bool,
|
||||
_: bool,
|
||||
indent: u16,
|
||||
) {
|
||||
buf.ensure_ends_with_newline();
|
||||
buf.indent(indent);
|
||||
buf.push_str("dbg");
|
||||
|
||||
let return_indent = if is_multiline {
|
||||
buf.newline();
|
||||
indent + INDENT
|
||||
} else {
|
||||
buf.spaces(1);
|
||||
indent
|
||||
};
|
||||
buf.spaces(1);
|
||||
|
||||
condition.format(buf, return_indent);
|
||||
condition.format(buf, indent);
|
||||
}
|
||||
|
||||
fn fmt_expect<'a>(buf: &mut Buf, condition: &'a Loc<Expr<'a>>, is_multiline: bool, indent: u16) {
|
||||
|
|
|
@ -956,22 +956,17 @@ fn fmt_dbg<'a>(
|
|||
buf: &mut Buf,
|
||||
condition: &'a Loc<Expr<'a>>,
|
||||
continuation: &'a Loc<Expr<'a>>,
|
||||
is_multiline: bool,
|
||||
_: bool,
|
||||
indent: u16,
|
||||
) {
|
||||
|
||||
buf.ensure_ends_with_newline();
|
||||
buf.indent(indent);
|
||||
buf.push_str("dbg");
|
||||
|
||||
let return_indent = if is_multiline {
|
||||
buf.newline();
|
||||
indent + INDENT
|
||||
} else {
|
||||
buf.spaces(1);
|
||||
indent
|
||||
};
|
||||
buf.spaces(1);
|
||||
|
||||
condition.format(buf, return_indent);
|
||||
condition.format(buf, indent);
|
||||
|
||||
// Always put a blank line after the `dbg` line(s)
|
||||
buf.ensure_ends_with_blank_line();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
dbg
|
||||
(
|
||||
5,
|
||||
666,
|
||||
)
|
||||
dbg (
|
||||
5,
|
||||
666,
|
||||
)
|
||||
|
||||
4
|
Loading…
Add table
Add a link
Reference in a new issue