void () { myLineToGutterRenderersCacheForLogicalLines = logicalLinesMatchVisualOnes(); myLineToGutterRenderers = new Int2ObjectOpenHashMap<>(); processRangeHighlighters(0, myEditor.getDocument().getTextLength(), highlighter -> { GutterMark renderer = highlighter.getGutterIconRenderer(); if (!shouldBeShown(renderer)) { return; } if (!isHighlighterVisible(highlighter)) { return; } int line = myEditor.offsetToVisualLine(highlighter.getStartOffset()); List<GutterMark> renderers = myLineToGutterRenderers.get(line); if (renderers == null) { renderers = new SmartList<>(); myLineToGutterRenderers.put(line, renderers); } renderers.add(renderer); }); FoldRegion[] topLevelRegions = myEditor.getFoldingModel().fetchTopLevel(); if (topLevelRegions != null) { for (FoldRegion region : topLevelRegions) { if (region instanceof CustomFoldRegion) { GutterIconRenderer renderer = ((CustomFoldRegion)region).getGutterIconRenderer(); int line = myEditor.offsetToVisualLine(region.getStartOffset()); if (shouldBeShown(renderer)) { myLineToGutterRenderers.put(line, List.of(renderer)); } else { myLineToGutterRenderers.remove(line); } } } } List<GutterMarkPreprocessor> gutterMarkPreprocessors = GutterMarkPreprocessor.EP_NAME.getExtensionList(); for (Int2ObjectMap.Entry<List<GutterMark>> entry : Int2ObjectMaps.fastIterable(myLineToGutterRenderers)) { List<GutterMark> newValue = entry.getValue(); for (GutterMarkPreprocessor preprocessor : gutterMarkPreprocessors) { newValue = preprocessor.processMarkers(entry.getValue()); } // don't allow more than 4 icons per line entry.setValue(ContainerUtil.getFirstItems(newValue, 4)); } }