PsiReference[] (@NotNull PsiElement element, GrNamedArgument namedArgument, @NotNull ProcessingContext context) { String labelName = namedArgument.getLabelName(); if (labelName == null) return PsiReference.EMPTY_ARRAY; if (!GroovyMethodInfo.getAllSupportedNamedArguments().contains(labelName)) { // Optimization: avoid unnecessary resolve. return PsiReference.EMPTY_ARRAY; } PsiElement call = PsiUtil.getCallByNamedParameter(namedArgument); if (!(call instanceof GrMethodCall)) return PsiReference.EMPTY_ARRAY; GrExpression invokedExpression = ((GrMethodCall)call).getInvokedExpression(); if (!(invokedExpression instanceof GrReferenceExpression)) return PsiReference.EMPTY_ARRAY; for (GroovyResolveResult result : ((GrReferenceExpression)invokedExpression).multiResolve(false)) { PsiElement eMethod = result.getElement(); if (!(eMethod instanceof PsiMethod method)) continue; for (GroovyMethodInfo info : GroovyMethodInfo.getInfos(method)) { Object referenceProvider = info.getNamedArgReferenceProvider(labelName); if (referenceProvider != null) { PsiReference[] refs; if (referenceProvider instanceof GroovyNamedArgumentReferenceProvider) { refs = ((GroovyNamedArgumentReferenceProvider)referenceProvider).createRef(element, namedArgument, result, context); } else { refs = ((PsiReferenceProvider)referenceProvider).getReferencesByElement(element, context); } if (refs.length > 0) { return refs; } } } } return PsiReference.EMPTY_ARRAY; }