@@ -1348,6 +1348,7 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
13481348 void completeTypeIdentifierWithDot (IdentTypeRepr *ITR) override ;
13491349 void completeTypeIdentifierWithoutDot (IdentTypeRepr *ITR) override ;
13501350
1351+ void completeCaseStmtKeyword () override ;
13511352 void completeCaseStmtBeginning () override ;
13521353 void completeCaseStmtDotPrefix () override ;
13531354 void completeDeclAttrKeyword (Decl *D, bool Sil, bool Param) override ;
@@ -4417,6 +4418,11 @@ void CodeCompletionCallbacksImpl::completeTypeIdentifierWithoutDot(
44174418 CurDeclContext = P.CurDeclContext ;
44184419}
44194420
4421+ void CodeCompletionCallbacksImpl::completeCaseStmtKeyword () {
4422+ Kind = CompletionKind::CaseStmtKeyword;
4423+ CurDeclContext = P.CurDeclContext ;
4424+ }
4425+
44204426void CodeCompletionCallbacksImpl::completeCaseStmtBeginning () {
44214427 assert (!InEnumElementRawValue);
44224428
@@ -4598,6 +4604,11 @@ static void addStmtKeywords(CodeCompletionResultSink &Sink, bool MaybeFuncBody)
45984604#include " swift/Syntax/TokenKinds.def"
45994605}
46004606
4607+ static void addCaseStmtKeywords (CodeCompletionResultSink &Sink) {
4608+ addKeyword (Sink, " case" , CodeCompletionKeywordKind::kw_case);
4609+ addKeyword (Sink, " default" , CodeCompletionKeywordKind::kw_default);
4610+ }
4611+
46014612static void addLetVarKeywords (CodeCompletionResultSink &Sink) {
46024613 addKeyword (Sink, " let" , CodeCompletionKeywordKind::kw_let);
46034614 addKeyword (Sink, " var" , CodeCompletionKeywordKind::kw_var);
@@ -4687,6 +4698,10 @@ void CodeCompletionCallbacksImpl::addKeywords(CodeCompletionResultSink &Sink,
46874698 addAnyTypeKeyword (Sink);
46884699 break ;
46894700
4701+ case CompletionKind::CaseStmtKeyword:
4702+ addCaseStmtKeywords (Sink);
4703+ break ;
4704+
46904705 case CompletionKind::PostfixExpr:
46914706 case CompletionKind::PostfixExprParen:
46924707 case CompletionKind::SuperExpr:
@@ -5189,12 +5204,13 @@ void CodeCompletionCallbacksImpl::doneParsing() {
51895204 }
51905205 }
51915206 break ;
5192- case CompletionKind::AfterIfStmtElse:
5193- // Handled earlier by keyword completions.
5194- break ;
51955207 case CompletionKind::PrecedenceGroup:
51965208 Lookup.getPrecedenceGroupCompletions (SyntxKind);
51975209 break ;
5210+ case CompletionKind::AfterIfStmtElse:
5211+ case CompletionKind::CaseStmtKeyword:
5212+ // Handled earlier by keyword completions.
5213+ break ;
51985214 }
51995215
52005216 for (auto &Request: Lookup.RequestedCachedResults ) {
0 commit comments