mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user