void (@NotNull InsertionContext context) { context.getDocument().replaceString(context.getStartOffset(), context.getTailOffset(), getInsertString()); context.commitDocument(); PsiMethodCallExpression call = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiMethodCallExpression.class, false); if (call == null) return; PsiExpression[] args = call.getArgumentList().getExpressions(); if (args.length != 1 || !(args[0] instanceof PsiMethodCallExpression innerCall)) return; PsiMethod collectorMethod = innerCall.resolveMethod(); if (collectorMethod != null && (!collectorMethod.getParameterList().isEmpty() || MethodSignatureUtil.hasOverloads(collectorMethod))) { context.getEditor().getCaretModel().moveToOffset(innerCall.getArgumentList().getFirstChild().getTextRange().getEndOffset()); } JavaCodeStyleManager.getInstance(context.getProject()).shortenClassReferences(innerCall); }