private @Nullable TextRange getRange(@NotNull PsiElement element) {
      if (!element.isValid()) throw new IllegalArgumentException();
      if (!PsiTreeUtil.isAncestor(myTracker.myCopyFile, element, false)) {
        PsiFile file = element.getContainingFile();
        // allow navigating to the beginning of files
        if (file.getViewProvider().getVirtualFile() instanceof LightVirtualFile lvf &&
            lvf.getParent() instanceof ChangedVirtualDirectory cvd) {
          myNavigationFile = new FutureVirtualFile(cvd.getOriginalFile(), lvf.getName(), lvf.getFileType());
        }
        else {
          myNavigationFile = file.getOriginalFile().getVirtualFile();
        }
        // TODO: track new file
        myTracker.myPositionDocument.removeDocumentListener(this);
        myTracker = tracker(file.getOriginalFile());
        myTracker.myPositionDocument.addDocumentListener(this, this);
        return element.getTextRange();
      }
      SmartPsiElementPointer<PsiElement> pointer = SmartPointerManager.createPointer(element);
      myTracker.unblock();
      Segment range = pointer.getRange();
      if (range == null) return null;
      return TextRange.create(range);
    }
private @Nullable TextRange getRange(@NotNull PsiElement element)