[CodeCompletion] Support a narrow case for producing trailing closures directly

This adds a narrow special case in code-completion for control-flow-like
methods such as DispatchQueue().sync that are () -> (), to add a new
completion where the trailing closure is immediately expanded rather
than having to invoke placeholder expansion as a second step.

rdar://problem/26628804
This commit is contained in:
Ben Langmuir
2016-07-01 13:53:57 -07:00
parent 20939dd9d0
commit c8f7da4de1
8 changed files with 268 additions and 135 deletions

View File

@@ -1178,7 +1178,7 @@ void CompletionBuilder::getFilterName(CodeCompletionString *str,
for (auto C : str->getChunks().slice(*FirstTextChunk)) {
if (C.is(ChunkKind::BraceStmtWithCursor))
break;
break; // Don't include brace-stmt in filter name.
if (C.is(ChunkKind::Equal)) {
OS << C.getText();
@@ -1222,8 +1222,6 @@ void CompletionBuilder::getDescription(SwiftResult *result, raw_ostream &OS,
if (FirstTextChunk.hasValue()) {
for (auto C : str->getChunks().slice(*FirstTextChunk)) {
using ChunkKind = CodeCompletionString::Chunk::ChunkKind;
if (C.is(ChunkKind::BraceStmtWithCursor))
break;
// FIXME: we need a more uniform way to handle operator completions.
if (C.is(ChunkKind::Equal))