boolean (@NotNull InsertionContext context, @NotNull LookupElement delegate, @NotNull PsiClass psiClass, boolean forAnonymous) { if (context.getCompletionChar() == '[') { return false; } PsiMethod constructor = JavaConstructorCallElement.extractCalledConstructor(delegate); final PsiElement place = context.getFile().findElementAt(context.getStartOffset()); assert place != null; ThreeState hasParams = constructor != null ? ThreeState.fromBoolean(!constructor.getParameterList().isEmpty()) : hasConstructorParameters(psiClass, place); RangeMarker refEnd = context.getDocument().createRangeMarker(context.getTailOffset(), context.getTailOffset()); JavaCompletionUtil.insertParentheses(context, delegate, false, hasParams, forAnonymous); if (constructor != null) { PsiCallExpression call = JavaMethodCallElement.findCallAtOffset(context, refEnd.getStartOffset()); if (call != null) { CompletionMemory.registerChosenMethod(constructor, call); } } return true; }