Skip to content

BasicFormat adds extra whitespace #1509

Closed
@bnbarham

Description

@bnbarham

Description

BasicFormat should not add a mandatory leading space if one already exists on the previous trailing or there is no previous. Similarly it should not add a trailing space if one already exists on the next leading or there is no next.

A good example of this is when combining refactorings. Placeholder expansion may want to format the returned closure. But if that closure is then used by a trailing closure conversion, we'll end up with two spaces between the arg label and the closure.

Steps to Reproduce

Format a simple closure ({ <#code#> }). That produces -

 {
    <#code#>
}

Then if that is added in a call as an additional trailing closure and that call is formatted we end up with two spaces, since we also add a space after : -

call {
    <#code#>
}arg2:  {
    <#code#>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions