Skip to content

Commit 4702edd

Browse files
committed
Add repeat code completion
1 parent 5418568 commit 4702edd

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,8 @@ void CodeCompletionCallbacksImpl::addKeywords(CodeCompletionResultSink &Sink,
10621062
addSuperKeyword(Sink, CurDeclContext);
10631063
addExprKeywords(Sink, CurDeclContext);
10641064
addAnyTypeKeyword(Sink, CurDeclContext->getASTContext().TheAnyType);
1065+
if (Kind == CompletionKind::ForEachSequence)
1066+
addKeyword(Sink, "repeat", CodeCompletionKeywordKind::kw_repeat);
10651067
break;
10661068

10671069
case CompletionKind::CallArg:

test/IDE/complete_loop.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_5 | %FileCheck %s -check-prefix=LOOP_5
88
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_6 | %FileCheck %s -check-prefix=LOOP_6
99
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_7 | %FileCheck %s -check-prefix=LOOP_6
10+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_8 | %FileCheck %s -check-prefix=LOOP_8
1011

1112
class Gen {
1213
func IntGen() -> Int { return 0 }
@@ -80,3 +81,9 @@ do {
8081
}
8182
// LOOP_6: Begin completions, 1 items
8283
// LOOP_6-CHECK-NEXT: Keyword[in]/None: in; name=in
84+
85+
// Pack Iteration
86+
do {
87+
for t in #^LOOP_8^# {}
88+
}
89+
// LOOP_8-DAG: Keyword[repeat]/None: repeat; name=repeat

0 commit comments

Comments
 (0)