Skip to content

Commit 2c4ec4b

Browse files
authored
vfmt: allow for automatic inline -> line comment reformatting (#25500)
1 parent 69a0ec3 commit 2c4ec4b

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module main
2+
3+
// inline comment
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module main
2+
3+
/* inline comment */

‎vlib/v/scanner/scanner.v‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,8 +1134,10 @@ pub fn (mut s Scanner) text_scan() token.Token {
11341134
col: u16_col(s.current_column() - comment.len - 4)
11351135
file_idx: s.file_idx
11361136
}
1137-
s.error_with_pos('inline comment is deprecated, please use line comment',
1138-
comment_pos)
1137+
if !s.pref.is_fmt {
1138+
s.error_with_pos('inline comment is deprecated, please use line comment',
1139+
comment_pos)
1140+
}
11391141
comment = '\x01' + comment.trim(' ')
11401142
}
11411143
return s.new_multiline_token(.comment, comment, comment.len + 4,

0 commit comments

Comments
 (0)