Tested on gdscript-formatter 0.21.0 (Pre-release 0.21.0-beta, published 2026-07-12), Linux x86_64. Upstream main checked up to 248fa13b (2026-07-12 09:20 UTC) — no fix commit found.
The empty-dict part ({} → { }) looks like a regression of #152 "Formatter is inserting a space inside of empty dictionary literals" (closed).
Impact (style-guide deviation, non-breaking)
The GDScript style guide — Whitespace section shows array[3] and dict["key"] with no space between the closing )/identifier/}/] and the following [. Formatter output diverges from that.
Trigger
Any subscript on the result of a call or cast — foo()[i], (x as Dictionary)[key], arr.split(".")[0]. Also any empty dict literal {}.
Repro
Input (bug.gd):
func demo() -> void:
var d: Dictionary = {}
var v: Variant = (d as Dictionary)["key"]
print(v)
Command:
gdscript-formatter --stdout --reorder-code bug.gd
Actual output
func demo() -> void:
var d: Dictionary = { }
var v: Variant = (d as Dictionary) ["key"]
print(v)
Expected (per official style guide)
func demo() -> void:
var d: Dictionary = {}
var v: Variant = (d as Dictionary)["key"]
print(v)
Tested on
gdscript-formatter 0.21.0(Pre-release0.21.0-beta, published 2026-07-12), Linux x86_64. Upstreammainchecked up to248fa13b(2026-07-12 09:20 UTC) — no fix commit found.The empty-dict part (
{}→{ }) looks like a regression of #152 "Formatter is inserting a space inside of empty dictionary literals" (closed).Impact (style-guide deviation, non-breaking)
The GDScript style guide — Whitespace section shows
array[3]anddict["key"]with no space between the closing)/identifier/}/]and the following[. Formatter output diverges from that.Trigger
Any subscript on the result of a call or cast —
foo()[i],(x as Dictionary)[key],arr.split(".")[0]. Also any empty dict literal{}.Repro
Input (
bug.gd):Command:
Actual output
Expected (per official style guide)