mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Enable type completion at beginning of attribute
for 'VarDecl' or if we don't know the kind of the decl. Property delegate allows arbitrary type name (with `@propertyDelegate` attr).
This commit is contained in:
@@ -1367,7 +1367,7 @@ public:
|
||||
void completeCaseStmtKeyword() override;
|
||||
void completeCaseStmtBeginning() override;
|
||||
void completeCaseStmtDotPrefix() override;
|
||||
void completeDeclAttrKeyword(Decl *D, bool Sil, bool Param) override;
|
||||
void completeDeclAttrBeginning(Decl *D, bool Sil, bool Param) override;
|
||||
void completeDeclAttrParam(DeclAttrKind DK, int Index) override;
|
||||
void completeInPrecedenceGroup(SyntaxKind SK) override;
|
||||
void completeNominalMemberBeginning(
|
||||
@@ -4601,9 +4601,8 @@ void CodeCompletionCallbacksImpl::completeDeclAttrParam(DeclAttrKind DK,
|
||||
CurDeclContext = P.CurDeclContext;
|
||||
}
|
||||
|
||||
void CodeCompletionCallbacksImpl::completeDeclAttrKeyword(Decl *D,
|
||||
bool Sil,
|
||||
bool Param) {
|
||||
void CodeCompletionCallbacksImpl::completeDeclAttrBeginning(Decl *D, bool Sil,
|
||||
bool Param) {
|
||||
Kind = CompletionKind::AttributeBegin;
|
||||
IsInSil = Sil;
|
||||
if (Param) {
|
||||
@@ -5378,6 +5377,11 @@ void CodeCompletionCallbacksImpl::doneParsing() {
|
||||
|
||||
case CompletionKind::AttributeBegin: {
|
||||
Lookup.getAttributeDeclCompletions(IsInSil, AttTargetDK);
|
||||
|
||||
// Provide any type name for property delegate.
|
||||
if (!AttTargetDK || *AttTargetDK == DeclKind::Var)
|
||||
Lookup.getTypeCompletionsInDeclContext(
|
||||
P.Context.SourceMgr.getCodeCompletionLoc());
|
||||
break;
|
||||
}
|
||||
case CompletionKind::AttributeDeclParen: {
|
||||
|
||||
Reference in New Issue
Block a user