swiftlang / swiftlang/swift-syntax

BasicFormat indents closure parameter

Open
#1,473 1 comment 0 reactions 0 assignees View on GitHub
BasicFormat
Dominant language
Swift
Stars
3.7k
Forks
553
Avg merge
5d 13h
Merged PRs (30d)
16

Description

```
func testClosureParam() {
var input = Parser("""
foo(someClosure: { _ in
return 1
})
""")
let call = ExprSyntax.parse(from: &input)

let formatted = call.formatted()
assertStringsEqualWithDiff(formatted.description, """
foo(someClosure: { _ in
return 1
})
""")
}
```

Produces:
```
failed - Actual output (+) differed from expected output (-):
–foo(someClosure: { _ in
– return 1
–})
+foo(someClosure: { _ in
+ return 1
+ })
```

Note the double indent on `return 1` and indent of `}`. Presumably we're always indenting on newlines within parameters of call expressions and then again from the code block.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.