void (@NotNull Map<TextRange, TextAttributes> ranges, @NotNull Collection<RangeHighlighter> highlighters) { HighlightManager highlightManager = HighlightManager.getInstance(myProject); for (Map.Entry<TextRange, TextAttributes> entry : ranges.entrySet()) { TextRange range = entry.getKey(); TextAttributes attributes = entry.getValue(); highlightManager.addOccurrenceHighlight(myEditor, range.getStartOffset(), range.getEndOffset(), attributes, 0, highlighters, null); } for (RangeHighlighter highlighter : highlighters) { highlighter.setGreedyToLeft(true); highlighter.setGreedyToRight(true); } }