IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiMethod method = PsiTreeUtil.getParentOfType(myReferenceExpression, PsiMethod.class); if (method == null) return IntentionPreviewInfo.EMPTY; List<ParameterInfoImpl> infos = getParameterInfos(method); String newParameters = "(" + StringUtil.join(infos, i -> i.getTypeText() + " " + i.getName(), ", ") + ")"; StringBuilder newText = new StringBuilder(); for (PsiElement child : method.getChildren()) { newText.append(child instanceof PsiParameterList ? newParameters : child.getText()); } return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, method.getText(), newText.toString()); }