@Nullable
  public static PsiParameter getParameterForArgument(@NotNull PsiExpression argument) {
    PsiElement argumentParent = argument.getParent();
    if (argumentParent instanceof PsiReferenceExpression) {
      PsiMethodCallExpression callForQualifier = tryCast(argumentParent.getParent(), PsiMethodCallExpression.class);
      if (callForQualifier != null) {
        PsiMethod method = callForQualifier.resolveMethod();
        if (method instanceof PsiExtensionMethod) {
          return ((PsiExtensionMethod)method).getTargetReceiverParameter();
        }
      }
    }
    PsiExpressionList argList = tryCast(argumentParent, PsiExpressionList.class);
    if (argList == null) return null;
    PsiElement parent = argList.getParent();
    if (parent instanceof PsiAnonymousClass) {
      parent = parent.getParent();
    }
    PsiCall call = tryCast(parent, PsiCall.class);
    if (call == null) return null;
    PsiExpression[] args = argList.getExpressions();
    int index = ArrayUtil.indexOf(args, argument);
    if (index == -1) return null;
    PsiMethod method = call.resolveMethod();
    if (method == null) return null;
    final PsiElement navElement = method.getNavigationElement();
    if (navElement instanceof PsiMethod navMethod) {
      method = navMethod;
    }
    PsiParameterList list = method.getParameterList();
    int count = list.getParametersCount();
    if (index >= count) return null;
    if (isVarArgCall(call) && index >= count - 1) return null;
    return method instanceof PsiExtensionMethod ? ((PsiExtensionMethod)method).getTargetParameter(index) : list.getParameter(index);
  }
@Nullable
  public static PsiParameter getParameterForArgument(@NotNull PsiExpression argument)