godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.56k stars 20.58k forks source link

Lambda requires extra line before End Of File #96228

Open Robert-K opened 1 month ago

Robert-K commented 1 month ago

Tested versions

System information

Windows 11, Godot 4.3-stable

Issue description

If I leave a lamda at the end of the file like this (line 12): image The parser throws an error: image However, this is fine (with extra line 13): image

Ignore the fact that I'm doing stupid signal stuff above and causing infinite recursion, that's not a bug that's lack of sleep 💩

Pretty annoying as I frequently write lambdas like this and they happen to be at the EOF.

Steps to reproduce

Open the MRP, issue.gd will not be parsed correctly.

Minimal reproduction project (MRP)

lambda-eof-mrp.zip

Cykyrios commented 1 month ago

I can confirm the issue on Linux (Manjaro KDE Wayland), although to be fair I always have a single empty line at EOF (and the editor adds one automatically if I don't anyway). Also, on my end the error looks different: image This occurs both when the parenthesis is on the same line as the function contents and when it's on its own line as in the screenshot.

Robert-K commented 3 weeks ago

{E6A61409-D3D7-457A-8D6B-35A6D3E7E8BA} As I just noticed that for the first time: It also happens when everything is inline.

jonathansekela commented 3 days ago

If no one else is on this one, I'll take it. Looks like it might be a good spot to get my feet wet without stepping on too many toes.