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

Tables with linebreaks become inline

Open Enzojz opened this issue 8 years ago • 1 comments

For example:

    local limits = {
        {
            inf = radRef + rad,
            mid = radRef + rad - radT,
            sup = radRef + 0.5 * rad,
        },
        {
            inf = radRef + 0.5 * rad,
            mid = radRef + radT,
            sup = radRef,
        },
    }

becomes

local limits = {{inf = radRef + rad, mid = radRef + rad - radT, sup = radRef + 0.5 * rad}, {inf = radRef + 0.5 * rad, mid = radRef + radT, sup = radRef}}
return {
    updateFn = updateFn,
    params = params
}

becomes

return {updateFn = updateFn, params = params}

This bug can be extended for similar case like:

    return group
        * pipe.map(pipe.map(fMake))
        * pipe.flatten()
        * pipe.flatten()
        * pipe.flatten()

become

return group * pipe.map(pipe.map(fMake)) * pipe.flatten() * pipe.flatten() * pipe.flatten()

or

        local upperPolys = pipe.new
            + junction.generatePolyArc(group1.upper.walls, "inf", "mid")(0, 0)
            + junction.generatePolyArc(group2.upper.walls, "mid", "sup")(0, 0)

becomes

local upperPolys = pipe.new + junction.generatePolyArc(group1.upper.walls, "inf", "mid")(0, 0) + junction.generatePolyArc(group2.upper.walls, "mid", "sup")(0, 0)

Enzojz avatar Jul 17 '17 19:07 Enzojz

I think the table issue you were having was fixed a while ago, as I can't reproduce it. Can you verify with the latest version? In this case, the latest version of vscode-lua will suffice.

As for the pipe snippets, I think that is addressed in #15, or am I misreading that?

trixnz avatar Jul 23 '17 17:07 trixnz