Skip to content

Wrapping of long function signatures #725

@ahoppen

Description

@ahoppen

Formatting this to 80 columns

func foo(someArgument: Int, andAnother: Int, andYetAnother: Int) -> Array<Substring> {
}

// produces

func foo(someArgument: Int, andAnother: Int, andYetAnother: Int) -> Array<
  Substring
> {}

Which is definitely not the most intuitive way of formatting it. I would have expected

func foo(
  someArgument: Int,
  andAnother: Int,
  andYetAnother: Int
) -> Array<Substring> {}

In a less extreme case, I would also expect the following to wrap the argument list instead of the return type

func foo(someArgument: Int, andAnother: Int, andYetAnother: Int, and: Int) -> Substring {}

// produces

func foo(someArgument: Int, andAnother: Int, andYetAnother: Int, and: Int)
  -> Substring
{}
func foo(someArgument: Int, andAnother: Int, andYet: Int, and: Int) -> Substring {}

// produces

func foo(someArgument: Int, andAnother: Int, andYet: Int, and: Int) -> Substring 
{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions