String (@NotNull PsiFile psiFile, int caretPosition, @NotNull Function<? super DocumentationComponent, String> componentEvaluator) { Project project = psiFile.getProject(); Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile); assertNotNull(document); Editor editor = EditorFactory.getInstance().createEditor(document, project); try { if (caretPosition >= 0) { editor.getCaretModel().moveToOffset(caretPosition); } return getDocumentationText(editor, componentEvaluator); } finally { EditorFactory.getInstance().releaseEditor(editor); } }