Long if statements are broken oddly
I'm not sure if this is a bug or a different code style from what I'm used to, but if I have a long if statement, like this one:
if firstCondition1 and secondCondition and thirdCondition and fourthCondition and fifthCondition and sixthCondition and seventhCondition then
code()
end
...After formatting it, it looks like this. Notice the space before then and the extra indentation before seventhCondition.
if
firstCondition1 and secondCondition and thirdCondition and fourthCondition and fifthCondition and sixthCondition and
seventhCondition
then
code()
end
I think this would've been the ideal result. No space before then, and the long line being broken WITHOUT adding any extra indentation. As long as you start a line with an operator, it's pretty clear that it's continuing the line before it.
if
firstCondition1 and secondCondition and thirdCondition and fourthCondition and fifthCondition and sixthCondition
and seventhCondition
then
code()
end
Thanks for your time!
imo both look a little odd to me! can't think of a better solution though
lately i've been breaking up my lua code to look like typescript:
if (
firstCondition1
and secondCondition
and thirdCondition
and fourthCondition
and fifthCondition
and sixthCondition
and seventhCondition
) then
code()
end
i'm working on a fork that will do this
I think that looks great!
Update: I gave up on my formatter and now I use use https://typescripttolua.github.io/ with Prettier, which is a million times better for a million different reasons.