Skip to content

if statements inside of lambdas are broken after formatting. #201

@derkork

Description

@derkork

Bug Description

The formatter removes the space between if and the following identifier in inline lambda functions, creating invalid syntax.

Input (valid GDScript):

visibility_changed.connect(func() -> void: if visible:_update())

Output (invalid GDScript):

visibility_changed.connect(func() -> void: ifvisible:_update())

How to Reproduce

test.gd.zip

# Run the formatter on test.gd
gdscript-formatter test.gd

# Check the diff - line 5 will show 'ifvisible' instead of 'if visible'

Version

gdscript-formatter 0.18.2

Expected Behavior

The space between if and visible should be preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamThe issue (likely) can't be solved in this repository: a library needs a change

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions