ChangedRangesInfo (@NotNull Document document, @NotNull List<? extends Range> changedRanges) { final List<TextRange> ranges = new ArrayList<>(); final List<TextRange> insertedRanges = new ArrayList<>(); for (Range range : changedRanges) { if (range.hasLines()) { int changeStartLine = range.getLine1(); int changeEndLine = range.getLine2(); int lineStartOffset = document.getLineStartOffset(changeStartLine); int lineEndOffset = document.getLineEndOffset(changeEndLine - 1); TextRange changedTextRange = new TextRange(lineStartOffset, lineEndOffset); ranges.add(changedTextRange); if (!range.hasVcsLines()) { insertedRanges.add(changedTextRange); } } } return new ChangedRangesInfo(ranges, insertedRanges); }