LookupElement (final PsiMethod takeParametersFrom, PsiElement call, PsiMethod invoked) { PsiParameter[] parameters = takeParametersFrom.getParameterList().getParameters(); String lookupString = StringUtil.join(parameters, PsiNamedElement::getName, ", "); IconManager iconManager = IconManager.getInstance(); int w = iconManager.getPlatformIcon(PlatformIcons.Parameter).getIconWidth(); LayeredIcon icon = new LayeredIcon(2); icon.setIcon(iconManager.getPlatformIcon(PlatformIcons.Parameter), 0, 2 * w / 5, 0); icon.setIcon(iconManager.getPlatformIcon(PlatformIcons.Parameter), 1); LookupElementBuilder element = LookupElementBuilder.create(lookupString).withIcon(icon); boolean makeFinalIfNeeded = PsiTreeUtil.isAncestor(takeParametersFrom, call, true); element = element.withInsertHandler(new InsertHandler<>() { @Override public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { context.commitDocument(); int startOffset = context.getTailOffset(); PsiExpressionList exprList = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), startOffset - 1, PsiExpressionList.class, false); PsiElement rParen = exprList == null ? null : exprList.getLastChild(); if (rParen != null && rParen.textMatches(")")) { context.getDocument().deleteString(startOffset, rParen.getTextRange().getStartOffset()); } if (makeFinalIfNeeded) { context.commitDocument(); for (PsiParameter parameter : CompletionUtil.getOriginalOrSelf(takeParametersFrom).getParameterList().getParameters()) { VariableLookupItem.makeFinalIfNeeded(context, parameter); } } } }); element.putUserData(JavaCompletionUtil.SUPER_METHOD_PARAMETERS, Boolean.TRUE); return TailTypeDecorator.withTail(element, ExpectedTypesProvider.getFinalCallParameterTailType(call, invoked.getReturnType(), invoked)); }