List<TextRange> (@NotNull PsiFile file, @NotNull ChangedRangesInfo changedRangesInfo) { Document document = file.getViewProvider().getDocument(); List<TextRange> result = new ArrayList<>(); if (document != null) { LineFormattingRangesExtender extender = new LineFormattingRangesExtender(document); for (TextRange range : changedRangesInfo.allChangedRanges) { List<TextRange> extended = extender.getExtendedRanges(Collections.singletonList(range)); result.addAll(extended); } } else { result.addAll(changedRangesInfo.allChangedRanges); } return optimizedChangedRanges(result); }