Open swift-ci opened 8 years ago
Comment by shingo (JIRA)
Please fix this.
Promise hard to read.
https://github.com/mxcl/PromiseKit
README.md say
firstly {
when(fulfilled: fetchImage, fetchLocation)
}.done { image, location in
self.imageView.image = image
self.label.text = "\(location)"
}.ensure {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
}.catch { error in
self.show(UIAlertController(for: error), sender: self)
}
But, Xcode
firstly {
when(fulfilled: fetchImage, fetchLocation)
}.done { image, location in
self.imageView.image = image
self.label.text = "\(location)"
}.ensure {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
}.catch { error in
self.show(UIAlertController(for: error), sender: self)
}
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 3 | |Component/s | Source Tooling | |Labels | Bug | |Assignee | @nkcsgexi | |Priority | Medium | md5: 51aa435be00baf4ac468c07bab9de164blocks:
Issue Description:
Currently Xcode handles this indentation well:
However, if the arguments are not broken over multiple lines it looks like this:
Having the print statement at the same level as the closure's closing bracket makes it less clear that the closure has closed. At a glance a programmer may think that completion is an expression inside the first closure.
I expect it to look like this:
I'm also happy if it looks like this, although it's a little weird, it's at least consistent:
I expect indentation to approximately reflect the syntax tree, all arguments at the same level should get the same indentation. So sibling closures should get the same indentation on their closing bracket.
This is discussed in more detail here: https://github.com/apple/swift/pull/3754