Add repeat code completion

This commit is contained in:
Sima Nerush
2023-09-20 12:58:54 -07:00
parent b0af0f762d
commit a687032925
2 changed files with 9 additions and 0 deletions

View File

@@ -1062,6 +1062,8 @@ void CodeCompletionCallbacksImpl::addKeywords(CodeCompletionResultSink &Sink,
addSuperKeyword(Sink, CurDeclContext);
addExprKeywords(Sink, CurDeclContext);
addAnyTypeKeyword(Sink, CurDeclContext->getASTContext().TheAnyType);
if (Kind == CompletionKind::ForEachSequence)
addKeyword(Sink, "repeat", CodeCompletionKeywordKind::kw_repeat);
break;
case CompletionKind::CallArg:

View File

@@ -7,6 +7,7 @@
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_5 | %FileCheck %s -check-prefix=LOOP_5
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_6 | %FileCheck %s -check-prefix=LOOP_6
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_7 | %FileCheck %s -check-prefix=LOOP_6
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_8 | %FileCheck %s -check-prefix=LOOP_8
class Gen {
func IntGen() -> Int { return 0 }
@@ -80,3 +81,9 @@ do {
}
// LOOP_6: Begin completions, 1 items
// LOOP_6-CHECK-NEXT: Keyword[in]/None: in; name=in
// Pack Iteration
do {
for t in #^LOOP_8^# {}
}
// LOOP_8-DAG: Keyword[repeat]/None: repeat; name=repeat