void (int visualLine, @NotNull Collection<? extends RangeHighlighterEx> rangeHighlighters, boolean showInstantly, @NotNull HintHint hintInfo) { update(visualLine, showInstantly); ArrayList<? extends RangeHighlighterEx> highlighters = new ArrayList<>(rangeHighlighters); highlighters.sort((ex1, ex2) -> { LogicalPosition startPos1 = myEditor.offsetToLogicalPosition(ex1.getAffectedAreaStartOffset()); LogicalPosition startPos2 = myEditor.offsetToLogicalPosition(ex2.getAffectedAreaStartOffset()); if (startPos1.line != startPos2.line) return 0; return startPos1.column - startPos2.column; }); int contentInsets = JBUIScale.scale(2); // BalloonPopupBuilderImpl.myContentInsets final HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl(); boolean needDelay = false; if (myEditorPreviewHint == null) { needDelay = true; final JPanel editorFragmentPreviewPanel = new EditorFragmentPreviewPanel(contentInsets, highlighters); editorFragmentPreviewPanel.putClientProperty(BalloonImpl.FORCED_NO_SHADOW, Boolean.TRUE); myEditorPreviewHint = new LightweightHint(editorFragmentPreviewPanel) { @Override public void hide(boolean ok) { super.hide(ok); myDelayed = false; } }; myEditorPreviewHint.setForceLightweightPopup(true); } Point point = new Point(hintInfo.getOriginalPoint()); hintInfo.setTextBg(myEditor.getBackgroundColor()); Color borderColor = myEditor.getColorsScheme().getAttributes(EditorColors.CODE_LENS_BORDER_COLOR).getEffectColor(); hintInfo.setBorderColor(borderColor != null ? borderColor : myEditor.getColorsScheme().getDefaultForeground()); point = SwingUtilities.convertPoint(myEditor.getVerticalScrollBar(), point, myEditor.getComponent().getRootPane()); myPointHolder.set(point); myHintHolder.set(hintInfo); if (needDelay && !showInstantly) { myDelayed = true; Alarm alarm = new Alarm(); alarm.addRequest(() -> { if (myEditorPreviewHint == null || !myDelayed) return; showEditorHint(hintManager, myPointHolder.get(), myHintHolder.get()); myDelayed = false; }, /*Registry.intValue("ide.tooltip.initialDelay")*/300); } else if (!myDelayed) { showEditorHint(hintManager, point, hintInfo); } }