let value = SomeThing {
...
}
<HERE>
Since Parser parses code-completion token as a part of the expression,
completion failed to suggest 'value'. Also, the type of 'value' is
often '<<error type>>' because of the code completion token.
For now, disable additional trailing closure completion (suggesting
'label: { <#code#> }') on newline positions. Users still get the
compltion on the same line as the closing brace.
rdar://problem/66456159
Return type in the closure signature is often redundant when expanding
placeholders, because the type of the clossures are usually inferred
from the context (i.e. calling function), users don't need to write the
return type explicitly.
They are not only redundant, but also sometimes harmful when the return
type is a generic parameter or its requirement. Actually, there is no
correct spelling in such cases.
So omit the return type and the parentheses around the parameter clause.
rdar://problem/63607976
After trailing closure, we perform "Labeled trailing closure" completion
and fall back to other completion depending on the position.
If the completion happens at a newline position, it used to fallback to
global expression completion, but in type context, we should do override
completion instead.
Also, we didn't use to propagate 'hasCodeCompletion()' status properly.
rdar://problem/64650782
When completing a single argument for a trailing closure, pre-expand the
closure expression syntax instead of using a placeholder. It's not valid
to pass a non-closure anyway.
rdar://62189182