BaseInjection (PsiElement place) { PsiElement parent = place.getParent(); if (parent instanceof GrAssignmentExpression && ((GrAssignmentExpression)parent).getRValue() == place) { final GrExpression lvalue = ((GrAssignmentExpression)parent).getLValue(); if (lvalue instanceof GrReferenceExpression) { final PsiElement resolved = ((GrReferenceExpression)lvalue).resolve(); if (resolved instanceof PsiModifierListOwner) { return getLanguageParams((PsiModifierListOwner)resolved); } } } else if (parent instanceof GrVariable) { return getLanguageParams((PsiModifierListOwner)parent); } else if (parent instanceof GrArgumentList) { final PsiElement pparent = parent.getParent(); if (pparent instanceof GrCall call) { final GroovyResolveResult result = call.advancedResolve(); if (result.getElement() != null) { final Map<GrExpression, Pair<PsiParameter, PsiType>> map = GrClosureSignatureUtil .mapArgumentsToParameters(result, place, false, false, call.getNamedArguments(), call.getExpressionArguments(), call.getClosureArguments()); if (map != null) { final Pair<PsiParameter, PsiType> pair = map.get(place); return getLanguageParams(pair.first); } } } } return null; }