StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

No uncollapse simple expressions, `collapse_simple_statement` only when already collapsed

Open d-enk opened this issue 1 year ago • 1 comments

I would like simple expressions to can collapse, but complex not

This has been annoying for a very long time but I was too lazy to write issue)

that is, if there is already a newline no need to collapse

like gofmt behavior

next code can't be changed (additional option may be required)

if ok then return end

if ok then
  return
end

function func() return end

function func()
  return
end

I would also personally like so that there no new line instead ; between commands

some1(); some2(); break

but maybe I'm the only one so for now without a separate issue

d-enk avatar Jun 03 '24 17:06 d-enk

I'd also like an option to disable this rule, I found that in my Neovim configuration I often want collapsed functions and conditionals in some contexts, but not in others.

edit: Maybe all rules could have an input setting like --call-parentheses to disable them.

toupeira avatar May 16 '25 10:05 toupeira