void (int leftBraceStart, int leftBraceEnd, @Nullable IntUnaryOperator startComputation) { Editor editor = myEditor; Project project = editor.getProject(); if (project == null) { return; } LogicalPosition bracePosition = editor.offsetToLogicalPosition(leftBraceStart); Point braceLocation = editor.logicalPositionToXY(bracePosition); int y = braceLocation.y; myAlarm.addRequest(() -> ReadAction.run(() -> { if (project.isDisposed()) { return; } PsiDocumentManager.getInstance(project).performLaterWhenAllCommitted(() -> { if (editor.isDisposed() || !editor.getComponent().isShowing()) { return; } Rectangle viewRect = editor.getScrollingModel().getVisibleArea(); if (y >= viewRect.y) { return; } TextRange range = new TextRange(startComputation == null ? leftBraceStart : startComputation.applyAsInt(leftBraceStart), leftBraceEnd); Document document = editor.getDocument(); int line1 = document.getLineNumber(range.getStartOffset()); int line2 = document.getLineNumber(range.getEndOffset()); line1 = Math.max(line1, line2 - EditorFragmentComponent.getAvailableVisualLinesAboveEditor(editor) + 1); range = new TextRange(document.getLineStartOffset(line1), range.getEndOffset()); LightweightHint hint = EditorFragmentComponent.showEditorFragmentHint(editor, range, true, true); editor.putUserData(HINT_IN_EDITOR_KEY, hint); }); }), 300, ModalityState.stateForComponent(editor.getComponent())); }