fmt: cleanup comments.v with multiline comment (#20086)

This commit is contained in:
yuyi 2023-12-05 02:59:11 +08:00 committed by GitHub
parent c7b7d5f50f
commit 47a8051b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,16 +61,14 @@ pub fn (mut f Fmt) comment(node ast.Comment, options CommentsOptions) {
lines := node.text.split_into_lines()
f.write('/*')
for i, line in lines {
if i == lines.len - 1 {
f.empty_line = false
if node.text[node.text.len - 1] == `\n` {
f.writeln(line)
} else {
if i == lines.len - 1 {
f.write(line)
if node.text[node.text.len - 1] == `\n` {
f.writeln('')
}
f.write('*/')
} else {
f.empty_line = false
f.writeln(line.trim_right(' '))
}
}