Scony / godot-gdscript-toolkit

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

gdformat crashes with multi-line lambda functions #278

Closed Dracks closed 7 months ago

Dracks commented 7 months ago

Hello,

I was adding the gdsript toolkit to one project, and I find that gdformat raises some errors when processing/parsing files with lambda functions that have more than 1 line, one example is the following:

extends Node

class_name Whatever

var some_array: Array[Node]
var text: String = "a"

func check_array_for_a() -> int:
    var filtered_array : Array[Node] = some_array.filter(func(t: Node)-> bool:
        var obj : Whatever = t
        return obj.text == "a")
    return filtered_array.size()

The P/R I was working is this: https://github.com/Codename-Recon/Codename-Recon/pull/14

And here you can see the errors of the workflow (they also happen on my local machine) https://github.com/Codename-Recon/Codename-Recon/actions/runs/7657336543/job/20867789779?pr=14

Thanks!

Dracks commented 7 months ago

Sorry, I just saw the other issue: https://github.com/Scony/godot-gdscript-toolkit/issues/191