[CodeCompletion] Add keyword completion for 'some', 'any', 'repeat', and 'each'

The implementation is not 100% perfect but I don’t think it’s worth putting too much effort into it passing more information down in the parser if 'repeat' and 'each' are valid if we are going to remove the current parser anyway.

rdar://95725895
This commit is contained in:
Alex Hoppen
2023-11-23 21:44:40 -08:00
parent 81ea9981c8
commit 9cb2a248c6
8 changed files with 91 additions and 47 deletions

View File

@@ -176,6 +176,8 @@ bool SourceKit::CodeCompletion::addCustomCompletions(
}
break;
case CompletionKind::TypeDeclResultBeginning:
case CompletionKind::TypeBeginning:
case CompletionKind::TypeSimpleOrComposition:
case CompletionKind::TypeSimpleBeginning:
if (custom.Contexts.contains(CustomCompletionInfo::Type)) {
changed = true;
@@ -451,6 +453,8 @@ void CodeCompletionOrganizer::Impl::addCompletionsWithFilter(
bool hideLowPriority =
options.hideLowPriority &&
completionKind != CompletionKind::TypeDeclResultBeginning &&
completionKind != CompletionKind::TypeBeginning &&
completionKind != CompletionKind::TypeSimpleOrComposition &&
completionKind != CompletionKind::TypeSimpleBeginning &&
completionKind != CompletionKind::PostfixExpr;
for (Completion *completion : completions) {