EmmyLuaCodeStyle
EmmyLuaCodeStyle copied to clipboard
Line spacing settings have unexpected behaviour
Expectation
If I set the "line spacing" for something to be fixed(1), there should be one blank line enforced for the relevant items.
Reality
"Line spacing" is actually referring to the number of newlines (\n) that will be enforced, not (blank) lines.
Example
line_space_after_function_statement = fixed(1)
Expectation: There will be exactly 1 empty line after all functions.
I expect this Lua code:
function foo() print("Hello world") end
function bar() print("Hello from bar") end
function baz() print("Hello from baz") end
To format into this:
function foo() print("Hello world") end
function bar() print("Hello from bar") end
function baz() print("Hello from baz") end
But it actually formats into this:
function foo() print("Hello world") end
function bar() print("Hello from bar") end
function baz() print("Hello from baz") end
To get the expected behaviour you have to set the line spacing to 2, which is not very intuitive (especially when compared to other formatting tools).
In version 0.x, the setting was indeed as you expected. After version 1.x, I used std::size_t for most variables. For convenience, I usually consider 0 as an invalid value. and this configuration has been widely used in many projects, so its meaning will not be changed.
Can the documentation then at least be updated to note that "line spacing" is not actually line spacing?
Sure, but I am busy with the development of the language server. Perhaps you could submit a PR?