rokucommunity / brighterscript-formatter

A code formatter for BrighterScript (and BrightScript)
MIT License
15 stars 5 forks source link

Indenting confused by single line multi statement if statment #73

Open sjbrower opened 1 year ago

sjbrower commented 1 year ago

A single line but multi statement if confuses it unless the statement ends with a ':'

if X = 1: Y = 2: Z = 3: end if

will lose indenting on it and subsequent lines, but

if X = 1: Y = 2: Z = 3: end if:

works fine (notice the trailing colon).

TwitchBronBron commented 9 months ago

Here is another example:

function FormatTime(Seconds)
    Result = ""
if (Seconds > 86400): Result += (Seconds \ 86400).ToStr() + "d ": Seconds = Seconds mod 86400: end if
Result += (Seconds \ 3600).ToStr() + "h ": Seconds = Seconds mod 3600
Result += (Seconds \ 60).ToStr() + "m ": Seconds = Seconds mod 60
Result += (Seconds).ToStr() + "s "
return Result
end function