Skip to content

Generic type parameters in return types incorrectly split across lines #283

Description

@portlek

The formatter incorrectly splits generic type parameters (like Dictionary and Array) across multiple lines, breaking the syntax.

Input:

func test() -> Dictionary[String, String]:
    return {}

Output (broken):

func test() -> Dictionary[
    String,
    String
]:
    return { }

Expected:
The generic type should remain intact as Dictionary[String, String] on a single line.

Reproduction:
gdscript-formatter --max-line-length 10

This also occurs with Array[...] types and without --max-line-length on longer functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions