Skip to content
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

[SR-11106] swift-format adds newline between array argument #370

Closed
keith opened this issue Jul 11, 2019 · 3 comments
Closed

[SR-11106] swift-format adds newline between array argument #370

keith opened this issue Jul 11, 2019 · 3 comments
Assignees
Labels
bug Something isn't working swift-format

Comments

@keith
Copy link
Member

keith commented Jul 11, 2019

Previous ID SR-11106
Radar None
Original Reporter @keith
Type Bug
Status Resolved
Resolution Done
Environment

#1

Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee @allevato
Priority Medium

md5: b20905f3b614d63b8ae9c0818416ca4e

Issue Description:

With this code:

NSLayoutConstraint.activate([
    view.centerYAnchor.constraint(equalTo: self.bottomAnchor, constant: 1),
    view.centerXAnchor.constraint(equalTo: self.centerXAnchor),
])

You get:

NSLayoutConstraint.activate(
  [
    view.centerYAnchor.constraint(equalTo: self.bottomAnchor, constant: 1),
    view.centerXAnchor.constraint(equalTo: self.centerXAnchor),
  ])

I would have expected it to leave it the way it was originally

@allevato
Copy link
Member

We have logic that lets opening delimiters (brace, bracket, paren) to stay on the same line as what precedes it in a function call to prevent an unnecessary level of nesting, but that was only applied to situations where the delimiter follows a colon (i.e., labeled arguments). It needs to be extended to support unlabeled arguments as well.

@allevato
Copy link
Member

This was fixed for the case called out here (unlabeled single arguments) in #20. I'm holding off on declaring it done until we do the same for a labeled single argument.

@allevato
Copy link
Member

#22 fixes this for a single labeled argument, so now we can close this out.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from swiftlang/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift-format
Projects
None yet
Development

No branches or pull requests

2 participants