void (LookupElement element, InsertionContext context, PsiMethod method, PsiCallExpression methodCall) { if (!CodeInsightSettings.getInstance().SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION || context.getCompletionChar() == Lookup.COMPLETE_STATEMENT_SELECT_CHAR || context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR || methodCall == null || methodCall.getContainingFile() instanceof PsiCodeFragment || element.getUserData(JavaMethodMergingContributor.MERGED_ELEMENT) != null) { return; } PsiParameterList parameterList = method.getParameterList(); int parametersCount = parameterList.getParametersCount(); PsiExpressionList parameterOwner = methodCall.getArgumentList(); if (parameterOwner == null || !"()".equals(parameterOwner.getText()) || parametersCount == 0) { return; } Editor editor = context.getEditor(); if (editor instanceof EditorWindow) return; Project project = context.getProject(); Document document = editor.getDocument(); PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document); int limit = getCompletionHintsLimit(); CaretModel caretModel = editor.getCaretModel(); int offset = caretModel.getOffset(); int afterParenOffset = offset + 1; if (afterParenOffset < document.getTextLength() && Character.isJavaIdentifierPart(document.getImmutableCharSequence().charAt(afterParenOffset))) { return; } int braceOffset = offset - 1; int numberOfParametersToDisplay = parametersCount > 1 && PsiImplUtil.isVarArgs(method) ? parametersCount - 1 : parametersCount; int numberOfCommas = Math.min(numberOfParametersToDisplay, limit) - 1; String commas = Registry.is("editor.completion.hints.virtual.comma") ? "" : StringUtil.repeat(", ", numberOfCommas); document.insertString(offset, commas); PsiDocumentManager.getInstance(project).commitDocument(document); MethodParameterInfoHandler handler = new MethodParameterInfoHandler(); ShowParameterInfoContext infoContext = new ShowParameterInfoContext(editor, project, context.getFile(), offset, braceOffset); if (!methodCall.isValid() || handler.findElementForParameterInfo(infoContext) == null) { document.deleteString(offset, offset + commas.length()); return; } setCompletionMode(methodCall, true); context.setLaterRunnable(() -> { Object[] itemsToShow = infoContext.getItemsToShow(); PsiExpressionList methodCallArgumentList = methodCall.getArgumentList(); ParameterInfoControllerBase controller = ParameterInfoControllerBase.createParameterInfoController(project, editor, braceOffset, itemsToShow, null, methodCallArgumentList, handler, false, false); Disposable hintsDisposal = () -> setCompletionMode(methodCall, false); if (Disposer.isDisposed(controller)) { Disposer.dispose(hintsDisposal); document.deleteString(offset, offset + commas.length()); } else { ParameterHintsPass.asyncUpdate(methodCall, editor); Disposer.register(controller, hintsDisposal); } }); }