Skip to content

BasicFormat adds extra whitespace #1509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bnbarham opened this issue Apr 9, 2023 · 2 comments
Closed

BasicFormat adds extra whitespace #1509

bnbarham opened this issue Apr 9, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@bnbarham
Copy link
Contributor

bnbarham commented Apr 9, 2023

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#>
}
@bnbarham bnbarham added the bug Something isn't working label Apr 9, 2023
@ahoppen
Copy link
Member

ahoppen commented Apr 9, 2023

rdar://107808566

@ahoppen
Copy link
Member

ahoppen commented Apr 24, 2023

Fixed by #1550

@ahoppen ahoppen closed this as completed Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants