JohnnyMorganz/StyLua

Is it possible to allow inline functions?

jesseleite opened this issue · 4 comments

For example, if I want to do something like this...

{ '<Leader><Leader>w', function() vim.bo.wrap = true end }

It forces format to...

{
	'<Leader><Leader>w',
	function()
		vim.bo.wrap = true
	end,
}

Wondering if we can configure StyLua a bit more hands-off when it comes to simple inline functions?

Please check out the collapse_simple_statement configuration - does that suit your needs?

@JohnnyMorganz I tried all the options, but it seems like there's no option to just leave my functions however I choose format them, depending on the size. Sometimes I like to inline, sometimes I don't. The collapse_simple_statement config seems to be an always or never kinda thing, and I wish I could just disable that formatting altogether.

Btw appreciate your reply, and all your rad work on this package! 🔥❤️

#248 (comment)

The explanation here is why we don't rely on input to influence output formatting

Going to close this issue for now as there is nothing actionable. As mentioned in the above explanation, relying on input to influence output is very unlikely to happen (as it affects consistency).

Please feel free to reopen if you would like to add anything.