Skip to content

Unindent doesn't match the previous indentation level when using .map and lambdas #326

Description

@rinart73

Godot: 4.7.1
GDScript formatter: 0.24.0
Settings: default, except for "Format mode - Reorder code"
Error: Parse Error: Unindent doesn't match the previous indentation level.

This is what formatter produces.

func save() -> Dictionary:
	return {
		"best_total_score": 0,
		"levels": levels.map(
			func(item: LevelState):
				return item.save(),
		), # this line is marked with the error
	}

upd. strangely enough if I add return type (that I forgot to add, my bad), the error disappears? So it's maybe a GDScript issue?

func save() -> Dictionary:
	return {
		"best_total_score": 0,
		"levels": levels.map(
			func(item: LevelState) -> Dictionary:
				return item.save(),
		),
	}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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