void () { if (!StringContentIndentUtil.isDocumentUpdated(myEditor)) return; MarkupModel model = myEditor.getMarkupModel(); Map<TextRange, RangeHighlighter> oldHighlighters = StringContentIndentUtil.getIndentHighlighters(myEditor); List<RangeHighlighter> newHighlighters = new ArrayList<>(); for (StringContentIndent indent : myIndents) { TextRange newRange = new TextRange(indent.startOffset, indent.endOffset); int newIndent = indent.column; // do not show guide if indent is zero or text block is invalid if (newIndent <= 0) continue; RangeHighlighter oldHighlighter = oldHighlighters.get(newRange); if (oldHighlighter != null && StringContentIndentUtil.getIndent(oldHighlighter) == newIndent) { newHighlighters.add(oldHighlighter); oldHighlighters.remove(newRange); } else { RangeHighlighter newHighlighter = model.addRangeHighlighter(null, indent.startOffset, indent.endOffset, 0, HighlighterTargetArea.EXACT_RANGE); newHighlighter.setCustomRenderer(RENDERER); StringContentIndentUtil.setIndent(newHighlighter, newIndent); newHighlighters.add(newHighlighter); } } oldHighlighters.values().forEach(RangeMarker::dispose); StringContentIndentUtil.addIndentHighlighters(myEditor, newHighlighters); StringContentIndentUtil.updateTimestamp(myEditor); }