void (@NotNull PsiElement element) { final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)element; final PsiExpressionList argumentList = methodCallExpression.getArgumentList(); final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); final PsiReferenceParameterList parameterList = methodExpression.getParameterList(); CommentTracker commentTracker = new CommentTracker(); if (parameterList != null) { final int dotIndex = replacementText.lastIndexOf('.') + 1; replacementText = replacementText.substring(0, dotIndex) + commentTracker.text(parameterList) + replacementText.substring(dotIndex); } PsiReplacementUtil.replaceExpressionAndShorten(methodCallExpression, replacementText + commentTracker.text(argumentList), commentTracker); }