1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: fix blank line inserts between enum attribute comments (#18361)

This commit is contained in:
Turiiya 2023-06-08 00:54:38 +02:00 committed by GitHub
parent 6208b31d9f
commit bcd5c91bdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -422,6 +422,11 @@ fn (f Fmt) should_insert_newline_before_node(node ast.Node, prev_node ast.Node)
return false
}
}
if stmt is ast.EnumDecl {
if stmt.attrs.len > 0 && stmt.attrs[0].pos.line_nr - prev_line_nr <= 1 {
return false
}
}
if stmt is ast.FnDecl {
if stmt.attrs.len > 0 && stmt.attrs[0].pos.line_nr - prev_line_nr <= 1 {
return false

View File

@ -0,0 +1,16 @@
// CollisionType is an enum that categorizes entities for the purpose of collision detection, used in Collider ECS component.
// The flag attribute allows for multiple EntityType values to be combined, enabling entities to be categorized as multiple types.
[flag]
pub enum CollisionType {
obstacle
chicken
egg
}
// Another descriptive comment with a linebreak separated from the next enum decl.
[flag]
pub enum Direction {
left
right
}