PsiParameter (PsiElement element) { PsiElement p = element.getParent(); if (!(p instanceof PsiExpressionList list)) return null; PsiElement parent = list.getParent(); if (!(parent instanceof PsiCallExpression)) return null; PsiExpression[] arguments = list.getExpressions(); int i = ArrayUtil.indexOf(arguments, element); if (i != -1) { final PsiCallExpression call = (PsiCallExpression)parent; final PsiMethod method = call.resolveMethod(); if (method != null) { final PsiParameter[] parameters = method.getParameterList().getParameters(); if (parameters.length > i) { return parameters[i]; } else if (parameters.length > 0) { final PsiParameter lastParam = parameters[parameters.length - 1]; if (lastParam.getType() instanceof PsiEllipsisType) { return lastParam; } } } } return null; }