When formatting Lua files that contain blank lines inside indented blocks (e.g. between statements in a function body or between table fields), luafmt produces lines that contain leading whitespace matching the current indentation level rather than being truly blank.
local function foo()
local a = 1
------- <- luafmt adds indent here
local b = 2
end
Expected behavior:
I expect a blank line to contain no characters, just a newline.
If this was intentional, please add an option to configure it. Many editors and git hooks can be configured to strip trailing whitespace on save. When that setting is enabled, the file is modified every time it is saved after being formatted, creating a persistent diff where luafmt and the editor continuously undo each other's changes.
My workaround for now is to set max_blank_lines = 0.
When formatting Lua files that contain blank lines inside indented blocks (e.g. between statements in a function body or between table fields),
luafmtproduces lines that contain leading whitespace matching the current indentation level rather than being truly blank.Expected behavior:
I expect a blank line to contain no characters, just a newline.
If this was intentional, please add an option to configure it. Many editors and git hooks can be configured to strip trailing whitespace on save. When that setting is enabled, the file is modified every time it is saved after being formatted, creating a persistent diff where luafmt and the editor continuously undo each other's changes.
My workaround for now is to set
max_blank_lines = 0.