TooltipRenderer (@NotNull Collection<? extends RangeHighlighter> highlighters) { ApplicationManager.getApplication().assertIsNonDispatchThread(); LineTooltipRenderer bigRenderer = null; List<HighlightInfo> infos = new SmartList<>(); Collection<String> tooltips = new HashSet<>(); //do not show the same tooltip twice for (RangeHighlighter marker : highlighters) { Object tooltipObject = marker.getErrorStripeTooltip(); if (tooltipObject == null) continue; if (tooltipObject instanceof HighlightInfo info) { String toolTip = info.getToolTip(); if (toolTip != null && tooltips.add(toolTip)) { infos.add(info); } } else { //noinspection HardCodedStringLiteral @NlsContexts.Tooltip String text = tooltipObject.toString(); if (tooltips.add(text)) { if (bigRenderer == null) { bigRenderer = new DaemonTooltipRenderer(text, 0, new Object[]{highlighters}); } else { bigRenderer.addBelow(text); } } } } if (!infos.isEmpty()) { // show errors first ContainerUtil.quickSort(infos, (o1, o2) -> { int i = SeverityRegistrar.getSeverityRegistrar(myProject).compare(o2.getSeverity(), o1.getSeverity()); if (i != 0) return i; return StringUtil.compare(o1.getToolTip(), o2.getToolTip(), false); }); HighlightInfoComposite composite = HighlightInfoComposite.create(infos); String toolTip = composite.getToolTip(); TooltipAction action = TooltipActionProvider.calcTooltipAction(composite, myProject, myEditor); LineTooltipRenderer myRenderer = calcTooltipRenderer(toolTip, action, 0); if (bigRenderer != null) { myRenderer.addBelow(bigRenderer.getText()); } bigRenderer = myRenderer; } return bigRenderer; }