Skip to content

GDScript style guide: Newlines within arrays/dictionaries/enums  #3154

Open
@aaronfranke

Description

@aaronfranke

The style guide currently contains many places where they have line breaks:

var party = [
    "Godot",
    "Godette",
    "Steve",
]

var character_dir = {
    "Name": "Bob",
    "Age": 27,
    "Job": "Mechanic",
}

enum Tiles {
    TILE_BRICK,
    TILE_FLOOR,
    TILE_SPIKE,
    TILE_TELEPORT,
}

enum Element {
    EARTH,
    WATER,
    AIR,
    FIRE,
}

And many places where they don't:

my_array = [4, 5, 6]

enum Tiles {TILE_BRICK, TILE_FLOOR, TILE_SPIKE, TILE_TELEPORT}

enum Jobs {KNIGHT, WIZARD, ROGUE, HEALER, SHAMAN}

I've been using the former when I was updating the demo projects earlier, but I noticed the latter when I was reviewing godotengine/godot-demo-projects#405.

I think a style should be chosen for each of arrays/dictionaries/enums, or a guideline should be created for when to use which style (number of items? length of items? total enum length?) and if other styles are ever acceptable, like would this ever be allowed:

enum Tiles {
    TILE_BRICK, TILE_FLOOR,
    TILE_SPIKE, TILE_TELEPORT,
}

Metadata

Metadata

Assignees

Labels

area:manualIssues and PRs related to the Manual/Tutorials section of the documentationdiscussionenhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions