List<TextRange> (@NotNull Document beforeDocument, @NotNull Document currentDocument) { CharSequence beforeText = beforeDocument.getCharsSequence(); CharSequence currentText = currentDocument.getCharsSequence(); try { ComparisonManager manager = ComparisonManager.getInstance(); List<LineFragment> lineFragments = manager.compareLinesInner(beforeText, currentText, ComparisonPolicy.DEFAULT, DumbProgressIndicator.INSTANCE); List<TextRange> modifiedRanges = new ArrayList<>(); for (LineFragment lineFragment : lineFragments) { int fragmentStartOffset = lineFragment.getStartOffset2(); int fragmentEndOffset = lineFragment.getEndOffset2(); List<DiffFragment> innerFragments = lineFragment.getInnerFragments(); if (innerFragments != null) { for (DiffFragment innerFragment : innerFragments) { int innerFragmentStartOffset = fragmentStartOffset + innerFragment.getStartOffset2(); int innerFragmentEndOffset = fragmentStartOffset + innerFragment.getEndOffset2(); modifiedRanges.add(calculateChangeHighlightRange(currentText, innerFragmentStartOffset, innerFragmentEndOffset)); } } else { modifiedRanges.add(calculateChangeHighlightRange(currentText, fragmentStartOffset, fragmentEndOffset)); } } return modifiedRanges; } catch (DiffTooBigException e) { LOG.info(e); return Collections.emptyList(); } }