Scony / godot-gdscript-toolkit

Independent set of GDScript tools - parser, linter, formatter, and more
MIT License
944 stars 65 forks source link

Unable to format inline functions #282

Closed AcrylicShrimp closed 6 months ago

AcrylicShrimp commented 6 months ago

Below code is not getting formatted:

func _on_exit(_system: UINavigationSystem, _element: UIElement):
    var on_confirm = func _on_confirm(confirmed: bool):
        if confirmed:
            get_tree().quit()

    ui_confirm.show(self, "", on_confirm)
Scony commented 6 months ago

@AcrylicShrimp the above lambda is a multiline lambda - not an inline lambda:

As for multiline lambdas - those are not supported yet, see https://github.com/Scony/godot-gdscript-toolkit/issues/191 As for inline lambdas, you can do the following:


func _on_exit(_system: UINavigationSystem, _element: UIElement):
    var on_confirm = func _on_confirm(confirmed: bool): if confirmed: get_tree().quit()
    ui_confirm.show(self, "", on_confirm)