private static @Nullable Block getBlockContaining(List<? extends Block> blockList, List<? extends TextRange> originalRanges, TextRange range, int depth) {
    for (Block block : blockList) {
      if (block.getTextRange().contains(range)) {
        if (TextRangeUtil.intersectsOneOf(block.getTextRange(), originalRanges)) {
          Block containingBlock = getBlockContaining(block.getSubBlocks(), originalRanges, range, depth + 1);
          if (containingBlock != null) return containingBlock;
        }
        return block;
      }
    }
    return null;
  }
private static @Nullable Block getBlockContaining(List<? extends Block> blockList, List<? extends TextRange> originalRanges, TextRange range, int depth)