@@ -1850,11 +1850,12 @@ void CompletionLookup::addKeyword(StringRef Name, StringRef TypeAnnotation,
18501850}
18511851
18521852void CompletionLookup::addDeclAttrParamKeyword (StringRef Name,
1853+ ArrayRef<StringRef> Parameters,
18531854 StringRef Annotation,
18541855 bool NeedSpecify) {
18551856 CodeCompletionResultBuilder Builder (Sink, CodeCompletionResultKind::Keyword,
18561857 SemanticContextKind::None);
1857- Builder.addDeclAttrParamKeyword (Name, Annotation, NeedSpecify);
1858+ Builder.addDeclAttrParamKeyword (Name, Parameters, Annotation, NeedSpecify);
18581859}
18591860
18601861void CompletionLookup::addDeclAttrKeyword (StringRef Name,
@@ -3012,23 +3013,27 @@ void CompletionLookup::getAttributeDeclCompletions(bool IsInSil,
30123013}
30133014
30143015void CompletionLookup::getAttributeDeclParamCompletions (
3015- CustomSyntaxAttributeKind AttrKind, int ParamIndex) {
3016+ CustomSyntaxAttributeKind AttrKind, int ParamIndex, bool HasLabel ) {
30163017 switch (AttrKind) {
30173018 case CustomSyntaxAttributeKind::Available:
30183019 if (ParamIndex == 0 ) {
3019- addDeclAttrParamKeyword (" *" , " Platform" , false );
3020+ addDeclAttrParamKeyword (" *" , /* Parameters= */ {}, " Platform" , false );
30203021
30213022#define AVAILABILITY_PLATFORM (X, PrettyName ) \
3022- addDeclAttrParamKeyword (swift::platformString (PlatformKind::X), " Platform " , \
3023- false );
3023+ addDeclAttrParamKeyword (swift::platformString (PlatformKind::X), \
3024+ /* Parameters= */ {}, " Platform " , false );
30243025#include " swift/AST/PlatformKinds.def"
30253026
30263027 } else {
3027- addDeclAttrParamKeyword (" unavailable" , " " , false );
3028- addDeclAttrParamKeyword (" message" , " Specify message" , true );
3029- addDeclAttrParamKeyword (" renamed" , " Specify replacing name" , true );
3030- addDeclAttrParamKeyword (" introduced" , " Specify version number" , true );
3031- addDeclAttrParamKeyword (" deprecated" , " Specify version number" , true );
3028+ addDeclAttrParamKeyword (" unavailable" , /* Parameters=*/ {}, " " , false );
3029+ addDeclAttrParamKeyword (" message" , /* Parameters=*/ {}, " Specify message" ,
3030+ true );
3031+ addDeclAttrParamKeyword (" renamed" , /* Parameters=*/ {},
3032+ " Specify replacing name" , true );
3033+ addDeclAttrParamKeyword (" introduced" , /* Parameters=*/ {},
3034+ " Specify version number" , true );
3035+ addDeclAttrParamKeyword (" deprecated" , /* Parameters=*/ {},
3036+ " Specify version number" , true );
30323037 }
30333038 break ;
30343039 case CustomSyntaxAttributeKind::FreestandingMacro:
@@ -3043,12 +3048,27 @@ void CompletionLookup::getAttributeDeclParamCompletions(
30433048 isRoleSupported &= isAttachedMacro (role);
30443049 }
30453050 if (isRoleSupported) {
3046- addDeclAttrParamKeyword (getMacroRoleString (role), " " , false );
3051+ addDeclAttrParamKeyword (getMacroRoleString (role), /* Parameters=*/ {},
3052+ /* Annotation=*/ " " , /* NeedsSpecify=*/ false );
30473053 }
30483054 }
30493055 break ;
30503056 case 1 :
3051- addDeclAttrParamKeyword (" names" , " Specify declared names" , true );
3057+ if (HasLabel) {
3058+ for (auto kind : getAllMacroIntroducedDeclNameKinds ()) {
3059+ auto name = getMacroIntroducedDeclNameString (kind);
3060+ SmallVector<StringRef, 1 > Parameters;
3061+ if (macroIntroducedNameRequiresArgument (kind)) {
3062+ Parameters = {" name" };
3063+ }
3064+ addDeclAttrParamKeyword (name, Parameters, /* Annotation=*/ " " ,
3065+ /* NeedsSpecify=*/ false );
3066+ }
3067+ } else {
3068+ addDeclAttrParamKeyword (" names" , /* Parameters=*/ {},
3069+ " Specify declared names" ,
3070+ /* NeedsSpecify=*/ true );
3071+ }
30523072 break ;
30533073 }
30543074 break ;
@@ -3126,7 +3146,8 @@ void CompletionLookup::getPrecedenceGroupCompletions(
31263146void CompletionLookup::getPoundAvailablePlatformCompletions () {
31273147
31283148 // The platform names should be identical to those in @available.
3129- getAttributeDeclParamCompletions (CustomSyntaxAttributeKind::Available, 0 );
3149+ getAttributeDeclParamCompletions (CustomSyntaxAttributeKind::Available, 0 ,
3150+ /* HasLabel=*/ false );
31303151}
31313152
31323153void CompletionLookup::getSelfTypeCompletionInDeclContext (
0 commit comments