public static int getArgumentIndex(PsiElement place) {
int parameterIndex = -1;
final DartArgumentList argumentList = PsiTreeUtil.getParentOfType(place, DartArgumentList.class, false);
if (place == argumentList) {
assert argumentList != null;
final DartFunctionDescription functionDescription = DartFunctionDescription.tryGetDescription(
(DartCallExpression)argumentList.getParent());
// the last one
parameterIndex = functionDescription == null ? -1 : functionDescription.getParameters().length - 1;
}
else if (argumentList != null) {
for (DartExpression expression : argumentList.getExpressionList()) {
++parameterIndex;
if (expression.getTextRange().getEndOffset() >= place.getTextOffset()) {