TextRange (@NotNull PsiMethodCallExpression expression, @NotNull PsiMethodCallExpression qualifierExpression) { final PsiReferenceExpression qualifierMethodExpression = qualifierExpression.getMethodExpression(); final PsiElement qualifierNameElement = qualifierMethodExpression.getReferenceNameElement(); final int startOffset = (qualifierNameElement != null ? qualifierNameElement : qualifierMethodExpression).getTextOffset(); final int endOffset = expression.getMethodExpression().getTextRange().getEndOffset(); return new TextRange(startOffset, endOffset).shiftRight(-expression.getTextOffset()); }