Description
0.22.1 fixed ternaries with \ continuations (#291), but the same bug still occurs when the ternary has no \ continuations but the else argument spans multiple lines.
Input
func _input(event):
var pitch_input = Input.get_axis("ui_up", "ui_down") if invert_pitch else Input.get_axis(
"ui_down",
"ui_up"
)
Output (broken)
func _input(event):
var pitch_input = Input.get_axis("ui_up", "ui_down")
if invert_pitch
else Input.get_axis(
"ui_down",
"ui_up",
)
Expected
Ternary should be preserved, possibly laid out like:
func _input(event):
var pitch_input = Input.get_axis("ui_up", "ui_down") if invert_pitch else Input.get_axis(
"ui_down",
"ui_up",
)
The formatter incorrectly treats if and else as statement keywords instead of ternary expression keywords.
Description
0.22.1 fixed ternaries with
\continuations (#291), but the same bug still occurs when the ternary has no\continuations but theelseargument spans multiple lines.Input
Output (broken)
Expected
Ternary should be preserved, possibly laid out like:
The formatter incorrectly treats
ifandelseas statement keywords instead of ternary expression keywords.