AutoCompletionDecision (@NotNull AutoCompletionContext context) { final CompletionParameters parameters = context.getParameters(); if (parameters.getCompletionType() != CompletionType.SMART && parameters.getCompletionType() != CompletionType.BASIC) { return null; } boolean needInsertBrace = false; boolean needInsertParenth = false; final LookupElement[] items = context.getItems(); if (items.length > 1) { String commonName = null; final ArrayList<PsiMethod> allMethods = new ArrayList<>(); for (LookupElement item : items) { Object o = item.getPsiElement(); if (item.getUserData(JavaCompletionUtil.FORCE_SHOW_SIGNATURE_ATTR) != null || !(o instanceof PsiMethod method)) { return AutoCompletionDecision.SHOW_LOOKUP; } String name = JavaMethodMergingContributor.joinLookupStrings(item); if (commonName != null && !commonName.equals(name)) { return AutoCompletionDecision.SHOW_LOOKUP; } if (hasOnlyClosureParams(method)) { needInsertBrace = true; } else { needInsertParenth = true; } if (needInsertBrace && needInsertParenth) { return AutoCompletionDecision.SHOW_LOOKUP; } commonName = name; allMethods.add(method); } for (LookupElement item : items) { JavaCompletionUtil.putAllMethods(item, allMethods); } return AutoCompletionDecision.insertItem(JavaMethodMergingContributor.findBestOverload(items)); } return super.handleAutoCompletionPossibility(context); }