@@ -3011,9 +3011,10 @@ void CompletionLookup::getAttributeDeclCompletions(bool IsInSil,
3011
3011
#include " swift/AST/Attr.def"
3012
3012
}
3013
3013
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:
3017
3018
if (ParamIndex == 0 ) {
3018
3019
addDeclAttrParamKeyword (" *" , " Platform" , false );
3019
3020
@@ -3029,6 +3030,28 @@ void CompletionLookup::getAttributeDeclParamCompletions(DeclAttrKind AttrKind,
3029
3030
addDeclAttrParamKeyword (" introduced" , " Specify version number" , true );
3030
3031
addDeclAttrParamKeyword (" deprecated" , " Specify version number" , true );
3031
3032
}
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 ;
3032
3055
}
3033
3056
}
3034
3057
@@ -3103,7 +3126,7 @@ void CompletionLookup::getPrecedenceGroupCompletions(
3103
3126
void CompletionLookup::getPoundAvailablePlatformCompletions () {
3104
3127
3105
3128
// The platform names should be identical to those in @available.
3106
- getAttributeDeclParamCompletions (DAK_Available , 0 );
3129
+ getAttributeDeclParamCompletions (CustomSyntaxAttributeKind::Available , 0 );
3107
3130
}
3108
3131
3109
3132
void CompletionLookup::getSelfTypeCompletionInDeclContext (
0 commit comments