Skip to content

Invalid indentation after gdformat #404

@graugraugrau

Description

@graugraugrau

I use gdformat in my project for checking before git commit. I experienced that it transformed my code to invalid code.
The following example reproduces what I have experienced.

Input:

func example_code() -> void:
	var array = [1,2,3,4,5,6,7,8,9]

	var string_array: Array[String] = []
	string_array.assign(
		(
			array.map(
				func(number_with_very_long_name: int): \
					return str(number_with_very_long_name) + "some unnecessary long string to make this bug reproducible"
			)
			as Array[int]
		)
	)

Outcome:

func example_code() -> void:
	var array = [1, 2, 3, 4, 5, 6, 7, 8, 9]

	var string_array: Array[String] = []
	string_array.assign(
		(
			array.map(
				func(number_with_very_long_name: int):
					return (
						str(number_with_very_long_name)
						+ "some unnecessary long string to make this bug reproducible"
					)
			)
			as Array[int]
		)
	)

It seems that a \ after the lambda function header would fix it.
func(number_with_very_long_name: int): \

I tried it with gdtoolkit 4.3.4 and gdtoolkit 4.3.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions