fmt: use iembed cmts in arrays at line start when exprs come afterwards (#9285)
parent
24630850a0
commit
f648e3f10d
|
@ -1832,8 +1832,10 @@ pub fn (mut f Fmt) array_init(node ast.ArrayInit) {
|
|||
set_comma = true
|
||||
}
|
||||
if cmt.pos.line_nr > expr_pos.last_line {
|
||||
embed := i + 1 < node.exprs.len
|
||||
&& node.exprs[i + 1].position().line_nr == cmt.pos.last_line
|
||||
f.writeln('')
|
||||
f.comment(cmt, {})
|
||||
f.comment(cmt, iembed: embed)
|
||||
} else {
|
||||
f.write(' ')
|
||||
f.comment(cmt, iembed: true)
|
||||
|
|
|
@ -68,3 +68,9 @@ fn keep_real_block_comment() {
|
|||
'eggs',
|
||||
]
|
||||
}
|
||||
|
||||
fn comment_at_line_start_with_expressions_after() {
|
||||
arr := [123456789012345, 234567890123456, 678901234567890, 789012345678901, /* at the end */
|
||||
345678901234567, /* in between */ 456789012345678,
|
||||
/* line start */ 567890123456789, 890123456789012]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue