GrNamedArgument (final GrNamedArgument namedArgument) { final GrNamedArgument[] namedArguments = getNamedArguments(); final GrExpression[] args = getExpressionArguments(); PsiElement anchor = null; final int namedCount = namedArguments.length; final int exprCount = args.length; if (namedCount > 0) { anchor = namedArguments[namedCount - 1]; } else if (exprCount > 0) { anchor = args[exprCount - 1]; } if (anchor != null) { anchor = PsiUtil.getNextNonSpace(anchor); } else { anchor = getRightParen(); } addBefore(namedArgument, anchor); return namedArgument; }