@@ -3011,9 +3011,10 @@ void CompletionLookup::getAttributeDeclCompletions(bool IsInSil,
30113011#include " swift/AST/Attr.def"
30123012}
30133013
3014- void CompletionLookup::getAttributeDeclParamCompletions (DeclAttrKind AttrKind,
3015- int ParamIndex) {
3016- if (AttrKind == DAK_Available) {
3014+ void CompletionLookup::getAttributeDeclParamCompletions (
3015+ CustomSyntaxAttributeKind AttrKind, int ParamIndex) {
3016+ switch (AttrKind) {
3017+ case CustomSyntaxAttributeKind::Available:
30173018 if (ParamIndex == 0 ) {
30183019 addDeclAttrParamKeyword (" *" , " Platform" , false );
30193020
@@ -3029,6 +3030,28 @@ void CompletionLookup::getAttributeDeclParamCompletions(DeclAttrKind AttrKind,
30293030 addDeclAttrParamKeyword (" introduced" , " Specify version number" , true );
30303031 addDeclAttrParamKeyword (" deprecated" , " Specify version number" , true );
30313032 }
3033+ break ;
3034+ case CustomSyntaxAttributeKind::FreestandingMacro:
3035+ case CustomSyntaxAttributeKind::AttachedMacro:
3036+ switch (ParamIndex) {
3037+ case 0 :
3038+ for (auto role : getAllMacroRoles ()) {
3039+ bool isRoleSupported = isMacroSupported (role, Ctx);
3040+ if (AttrKind == CustomSyntaxAttributeKind::FreestandingMacro) {
3041+ isRoleSupported &= isFreestandingMacro (role);
3042+ } else if (AttrKind == CustomSyntaxAttributeKind::AttachedMacro) {
3043+ isRoleSupported &= isAttachedMacro (role);
3044+ }
3045+ if (isRoleSupported) {
3046+ addDeclAttrParamKeyword (getMacroRoleString (role), " " , false );
3047+ }
3048+ }
3049+ break ;
3050+ case 1 :
3051+ addDeclAttrParamKeyword (" names" , " Specify declared names" , true );
3052+ break ;
3053+ }
3054+ break ;
30323055 }
30333056}
30343057
@@ -3103,7 +3126,7 @@ void CompletionLookup::getPrecedenceGroupCompletions(
31033126void CompletionLookup::getPoundAvailablePlatformCompletions () {
31043127
31053128 // The platform names should be identical to those in @available.
3106- getAttributeDeclParamCompletions (DAK_Available , 0 );
3129+ getAttributeDeclParamCompletions (CustomSyntaxAttributeKind::Available , 0 );
31073130}
31083131
31093132void CompletionLookup::getSelfTypeCompletionInDeclContext (
0 commit comments