lua-fmt icon indicating copy to clipboard operation
lua-fmt copied to clipboard

Empty lines in tables are being erased

Open AgentOttsel opened this issue 7 years ago • 0 comments

I think that empty lines in tables are good for separating groups of fields and describing them by using comments, like this:

local table = {
    -- This field below is very interesting
    field = "123",

    -- WOW! Such nice fields!
    anotherField = 345,
    isThisVariableFalse = true,

    -- Good choices!
    favoriteColor = "#FF0000",
    favoriteTrigonometricFunction = math.cos,

    -- How poetic...
    anEmptyTable = {}
}

However, running lua-fmt, all the empty lines get erased, which causes the code to look rather messy:

local table = {
    -- This field below is very interesting
    field = "123",
    -- WOW! Such nice fields!
    anotherField = 345,
    isThisVariableFalse = true,
    -- Good choices!
    favoriteColor = "#FF0000",
    favoriteTrigonometricFunction = math.cos,
    -- How poetic...
    anEmptyTable = {}
}

AgentOttsel avatar Oct 15 '18 12:10 AgentOttsel