Files
swift-mirror/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp
Ben Langmuir 2bf014dc74 [expand-placeholder] Add support for multiple-trailing closures
Since placeholder expansion works with a single placeholder, which is
somewhat at odds with multiple-trailing closures, we eagerly attempt to
expand all consecutive placeholders of closure type. That is, if the API
has multiple closure parameters at the end, expanding any one of them
will transform all of them to the new syntax.

Example

```
foo(a: <#T##()->()#>, b: <#T##()->()#>)
```

expanding *either* parameter will produce the following:

```
foo {
  <#code#>
} b: {
  <#code#>
}
```

(caveat: the indentation is not part of placeholder expansion, but it's
added here for clarity)

At least for now we do not attempt to corral an existing closure into
the new syntax, so for

```
foo(a: { bar() }, b: <#T##()->()#>)
```

The exansion will be

```
foo(a: { bar() }) {
  <#code#>
}
```

as it was before.

rdar://59688632
2020-05-06 01:56:41 -04:00

92 KiB