trixnz / lua-fmt

lua-fmt is pretty-printer for Lua code
MIT License
189 stars 25 forks source link

Tables constructors are squished into a single line #1

Closed willmoffat closed 7 years ago

willmoffat commented 7 years ago

This looks like a very promising project, however it seems that table constructors are forced into a single line, making them hard to read.

Reduced testcase:

local f = { foo = true, bar = false,
    t = "It was a bright cold day in April, and the clocks were striking 13."
}

What luafmt gives:

local f = {foo = true, bar = false, t = "It was a bright cold day in April, and the clocks were striking 13."}

What I expect:

local f = {
    foo = true,
    bar = false,
    t = "It was a bright cold day in April, and the clocks were striking 13."
}
trixnz commented 7 years ago

This should be fixed (or, at the very least, improved) by v2.2.0: https://github.com/trixnz/lua-fmt/commit/7b1c9f3de3b887b7746ba4a39acd357cc716773a.

Unfortunately, I haven't got around to adding the new options to the CLI invocation script yet, so you will be stuck with the defaults for now (120 line width, double quotes).

willmoffat commented 7 years ago

Nice! Works for me :-)