godot-gdscript-toolkit
godot-gdscript-toolkit copied to clipboard
Multiline function parameters
Currently they resolve to this:
(
to_return
. assign(
[
[
IronStomach,
StrongStomach,
],
[
PickyEater,
AdventurousEater,
CulinaryExpert,
],
[Gourmand, Foodie, FastMetabolism, CulinaryExpert],
]
)
)
However having an option to output like this (ALA prettier.js) would be really nice:
to_return.assign([
[
IronStomach,
StrongStomach,
],
[
PickyEater,
AdventurousEater,
CulinaryExpert,
],
[Gourmand, Foodie, FastMetabolism, CulinaryExpert],
])
yeah, I've been thinking about it - I need to take a serious look and check if this is doable
Hi - I came to ask about this as well, but mostly because I seem to be seeing inconsistent formatting. Sometimes it seems to resolve to the first:
func _init(
_gridWorldSize: float,
_cellWorldSize: float,
startPosition: Vector2,
endPosition: Vector2,
onCreepUpdate: Callable
):
waypointManager = (
WaypointManager
. new(
startPosition,
endPosition,
)
)
while other times it seems to resolve to the second
func _ready():
navigationManager = NavigationManager.new(
gridWorldSize,
cellWorldSize,
Utils.toBoardVector(startNode.global_position),
Utils.toBoardVector(endNode.global_position),
updateCreepNode
)
These examples are from the same project, but different files (the second option is preferred). Happy to provide more details if needed.
I'm running Godot 4.1.1, and the VSCode extension version v1.2.3
@dxu in your case the difference comes from the fact that in some cases you're using trailing comma i.e. the following construct:
var x = [1,2,3,]
as opposed to
var x = [1,2,3]
In case of trailing comma, gdformat enforces multiline formatting.
Actually the above was covered much better in my comment - https://github.com/Scony/godot-gdscript-toolkit/issues/295#issuecomment-2013728958 so closing this one as duplicate.