void (final @NotNull PsiCallExpression expression) { int pos = -1; if (myContextStack.isEmpty()) { // always move the outmost item in the group to the top pos = targets.size(); } final PsiMethod psiMethod = expression.resolveMethod(); if (expression instanceof PsiMethodCallExpression callExpr) { PsiExpression qualifier = callExpr.getMethodExpression().getQualifierExpression(); if (qualifier != null) { qualifier.accept(this); } visitArguments(expression.getArgumentList(), psiMethod); } if (psiMethod != null) { myContextStack.push(psiMethod); } try { PsiElement callExpression = expression instanceof PsiMethodCallExpression callExpr ? callExpr.getMethodExpression().getReferenceNameElement() : expression instanceof PsiNewExpression newExpr ? newExpr.getClassOrAnonymousClassReference() : expression; if (psiMethod != null && (callExpression == null || matchLine(callExpression))) { MethodSmartStepTarget target = new MethodSmartStepTarget( psiMethod, null, callExpression, myInsideLambda || (expression instanceof PsiNewExpression newExpr && newExpr.getAnonymousClass() != null), null ); target.setOrdinal(Math.toIntExact(existingMethodCalls(targets, psiMethod).count())); if (pos != -1) { targets.add(pos, target); } else { targets.add(target); } } if (expression instanceof PsiMethodCallExpression) { checkTextRange(expression, true); } else { super.visitCallExpression(expression); } } finally { if (psiMethod != null) { myContextStack.pop(); } } }