ChangedRangesInfo (@NotNull PsiFile file) { Project project = file.getProject(); Document document = PsiDocumentManager.getInstance(project).getDocument(file); if (document == null) return null; LineStatusTracker<?> tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(document); List<? extends Range> trackerRanges = tracker != null ? tracker.getRanges() : null; if (trackerRanges != null) { return getChangedRangesInfo(document, trackerRanges); } if (ApplicationManager.getApplication().isUnitTestMode()) { CharSequence testContent = file.getUserData(TEST_REVISION_CONTENT); if (testContent != null) { return getChangedRangesInfo(document, computeRanges(document, testContent)); } } Change change = ChangeListManager.getInstance(project).getChange(file.getVirtualFile()); if (change == null) { return null; } if (change.getType() == Change.Type.NEW) { TextRange fileRange = file.getTextRange(); return new ChangedRangesInfo(List.of(fileRange), null); } String contentFromVcs = getRevisionedContentFrom(change.getBeforeRevision()); if (contentFromVcs == null) { return null; } return getChangedRangesInfo(document, computeRanges(document, contentFromVcs)); }