Godot 4.7.1, plugin version 0.22.0. (The formatter was run through CLI)
I wish this syntax worked, too, but unfortunately such formatting is not supported:
- CheatPanel.add_cheat(&'heal_hero', 'Heal the hero', (func() -> void: health = max_health), self)
+ CheatPanel.add_cheat(
+ &'heal_hero',
+ 'Heal the hero',
+ (func() -> void:
+ health = max_health
+ ),
+ self,
+ )
Valid formatting example:
CheatPanel.add_cheat(
&'toggle_godmode',
'Toggle godmode',
(func() -> void:
god_mode = !god_mode
),
self,
)
or maybeeee
CheatPanel.add_cheat(
&'heal_hero',
'Heal the hero',
(func() -> void:
health = max_health
)
,
self,
)
The parentheses around the lambda function can be dropped. (They were there initially to separate the function body from the 4th argument self: otherwise the , operator is parsed as the continuation of the function body.) But the trailing comma is quite error-prone.
CheatPanel.add_cheat(
&'heal_hero',
'Heal the hero',
func() -> void:
health = max_health, # ← Easy to miss/erase
self,
)
Godot 4.7.1, plugin version 0.22.0. (The formatter was run through CLI)
I wish this syntax worked, too, but unfortunately such formatting is not supported:
Valid formatting example:
or maybeeee
The parentheses around the lambda function can be dropped. (They were there initially to separate the function body from the 4th argument
self: otherwise the,operator is parsed as the continuation of the function body.) But the trailing comma is quite error-prone.