GrParameter (GrExpression arg) { PsiElement parent = PsiUtil.skipParentheses(arg.getParent(), true); if (!(parent instanceof final GrArgumentList argList)) return null; parent = parent.getParent(); if (!(parent instanceof final GrMethodCall methodCall)) return null; if (!(methodCall.getInvokedExpression() instanceof GrReferenceExpression ref)) return null; final GroovyResolveResult resolveResult = ref.advancedResolve(); GrClosableBlock[] closures = methodCall.getClosureArguments(); final Map<GrExpression, Pair<PsiParameter, PsiType>> mapToParams = GrClosureSignatureUtil .mapArgumentsToParameters(resolveResult, arg, false, false, argList.getNamedArguments(), argList.getExpressionArguments(), closures); if (mapToParams == null) return null; final Pair<PsiParameter, PsiType> parameterPair = mapToParams.get(arg); final PsiParameter parameter = Pair.getFirst(parameterPair); return parameter instanceof GrParameter? ((GrParameter)parameter):null; }