PsiCallExpression (PsiCallExpression parentCall, int pos, int shift) { PsiCallExpression parentCopy = (PsiCallExpression)parentCall.copy(); PsiExpressionList parentArgsCopy = Objects.requireNonNull(parentCopy.getArgumentList()); PsiCallExpression childCopy = (PsiCallExpression)parentArgsCopy.getExpressions()[pos]; PsiExpressionList childArgsCopy = Objects.requireNonNull(childCopy.getArgumentList()); if (shift > 0) { if (shift >= childArgsCopy.getExpressionCount()) { return null; } for(int i=0; i<shift; i++) { PsiExpression lastArg = ArrayUtil.getLastElement(childArgsCopy.getExpressions()); assert lastArg != null; parentArgsCopy.addAfter(lastArg, childCopy); lastArg.delete(); } } if (shift < 0) { if (parentArgsCopy.getExpressionCount() <= pos - shift) { return null; } for (int i = 0; i > shift; i--) { PsiExpression nextArg = parentArgsCopy.getExpressions()[pos + 1]; childArgsCopy.add(nextArg); nextArg.delete(); } } return parentCopy; }