vfmt: should allow empty lines

Created on 20 Nov 2020  路  3Comments  路  Source: vlang/v

V version: always the latest
OS: Windows 10 WSL2 Ubuntu 20.04

What did you do?

fn main() {
    mut x := 0
    if x == 0 {
        println(true)
    }

    println(x)
}
v fmt file.v



md5-bf3ad3fcbed996e8ee8b76d23000b67c



fn main() {
        mut x := 0
        if x == 0 {
                println(true)
        }
        println(x)
}

Explanation

As example, in my company we have a rule keep an empty line after each for, if, while block etc.
Some dudes do this for better code readability. So we should provide that option for the developers. Beeing too strict may result in rejection.

Bug vfmt

Most helpful comment

Allow one empty line. Compress multiple empty lines into one.

All 3 comments

Allow one empty line. Compress multiple empty lines into one.

Looks like #3917

Indeed, a duplicate.

Was this page helpful?
0 / 5 - 0 ratings