mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Fix newline after dbg formatting
This commit is contained in:
parent
4a0dce714b
commit
8c25c9aaf7
7 changed files with 70 additions and 1 deletions
|
@ -1387,10 +1387,26 @@ fn fmt_dbg_stmt<'a>(
|
||||||
)
|
)
|
||||||
.format_with_options(buf, parens, Newlines::Yes, indent);
|
.format_with_options(buf, parens, Newlines::Yes, indent);
|
||||||
|
|
||||||
|
let cont_lifted = expr_lift_spaces(Parens::NotNeeded, buf.text.bump(), &continuation.value);
|
||||||
|
|
||||||
|
if !cont_lifted.before.is_empty() {
|
||||||
|
format_spaces(buf, cont_lifted.before, Newlines::Yes, indent);
|
||||||
|
}
|
||||||
|
|
||||||
// Always put a newline after the `dbg` line(s)
|
// Always put a newline after the `dbg` line(s)
|
||||||
buf.ensure_ends_with_newline();
|
buf.ensure_ends_with_newline();
|
||||||
|
|
||||||
continuation.format(buf, indent);
|
format_expr_only(
|
||||||
|
&cont_lifted.item,
|
||||||
|
buf,
|
||||||
|
Parens::NotNeeded,
|
||||||
|
Newlines::Yes,
|
||||||
|
indent,
|
||||||
|
);
|
||||||
|
|
||||||
|
if !cont_lifted.after.is_empty() {
|
||||||
|
format_spaces(buf, cont_lifted.after, Newlines::Yes, indent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_return<'a>(
|
fn fmt_return<'a>(
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
dbg l #
|
||||||
|
n
|
|
@ -0,0 +1,46 @@
|
||||||
|
Defs(
|
||||||
|
Defs {
|
||||||
|
tags: [
|
||||||
|
EitherIndex(2147483648),
|
||||||
|
],
|
||||||
|
regions: [
|
||||||
|
@0-8,
|
||||||
|
],
|
||||||
|
space_before: [
|
||||||
|
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||||
|
],
|
||||||
|
space_after: [
|
||||||
|
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||||
|
],
|
||||||
|
spaces: [],
|
||||||
|
type_defs: [],
|
||||||
|
value_defs: [
|
||||||
|
Body(
|
||||||
|
@0-2 RecordDestructure(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
@3-8 Apply(
|
||||||
|
@3-6 Dbg,
|
||||||
|
[
|
||||||
|
@7-8 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "l",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
@10-11 SpaceBefore(
|
||||||
|
Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "n",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
LineComment(
|
||||||
|
"",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
|
@ -0,0 +1,2 @@
|
||||||
|
{}=dbg l#
|
||||||
|
n
|
|
@ -1,2 +1,3 @@
|
||||||
dbg (1 == 1)
|
dbg (1 == 1)
|
||||||
|
|
||||||
4
|
4
|
|
@ -2,4 +2,5 @@ dbg (
|
||||||
5,
|
5,
|
||||||
666,
|
666,
|
||||||
)
|
)
|
||||||
|
|
||||||
4
|
4
|
|
@ -331,6 +331,7 @@ mod test_snapshots {
|
||||||
pass/closure_with_underscores.expr,
|
pass/closure_with_underscores.expr,
|
||||||
pass/comma_prefixed_indented_record.expr,
|
pass/comma_prefixed_indented_record.expr,
|
||||||
pass/comment_after_annotation.expr,
|
pass/comment_after_annotation.expr,
|
||||||
|
pass/comment_after_dbg_in_empty_record_assignment.expr,
|
||||||
pass/comment_after_def.moduledefs,
|
pass/comment_after_def.moduledefs,
|
||||||
pass/comment_after_expr_in_parens.expr,
|
pass/comment_after_expr_in_parens.expr,
|
||||||
pass/comment_after_op.expr,
|
pass/comment_after_op.expr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue