Thanks for adding this option! I much prefer having some newlines in my if statements!
Using preserve-block-newline-gaps=Preserve when a function contains a blank line removes the line but adds a space after the function declaration.
Before:
function FuncWithBlankLine()
end
function FuncEmpty()
end
function FuncOneLiner() end
Run stylua --preserve-block-newline-gaps=Preserve --no-editorconfig --config-path NUL test.lua
After:
function FuncWithBlankLine()
end
function FuncEmpty() end
function FuncOneLiner() end
FuncWithBlankLine has a space on the end of the line: function FuncWithBlankLine()_
Expected: FuncOneLiner is unchanged as I'd expect, but I would expect FuncWithBlankLine and FuncEmpty to look the same.
function FuncWithBlankLine()
end
function FuncEmpty()
end
function FuncOneLiner() end
Additionally, the output is not stable. Running the same stylua command again removes the space and makes all functions look like FuncOneLiner. This is the same behaviour as using --preserve-block-newline-gaps=Never on the original file, so I think the intent was for the newline to be preserved instead of replacing it with a space.
Thanks for adding this option! I much prefer having some newlines in my if statements!
Using preserve-block-newline-gaps=Preserve when a function contains a blank line removes the line but adds a space after the function declaration.
Before:
Run
stylua --preserve-block-newline-gaps=Preserve --no-editorconfig --config-path NUL test.luaAfter:
FuncWithBlankLinehas a space on the end of the line:function FuncWithBlankLine()_Expected:
FuncOneLineris unchanged as I'd expect, but I would expectFuncWithBlankLineandFuncEmptyto look the same.Additionally, the output is not stable. Running the same stylua command again removes the space and makes all functions look like
FuncOneLiner. This is the same behaviour as using--preserve-block-newline-gaps=Neveron the original file, so I think the intent was for the newline to be preserved instead of replacing it with a space.