private static boolean isIntersectWithRanges(@NotNull Collection<TextRange> ranges, int start, int end) {
    for (TextRange range : ranges) {
      if (start <= range.getStartOffset() && end >= range.getEndOffset()) {
        continue; // range is inside [start, end]
      }

      if (end <= range.getStartOffset()) {
        continue; // range is on right
      }

      if (start >= range.getEndOffset()) {
        continue; // range is on right
      }

      return true;
    }
    return false;
  }
private static boolean isIntersectWithRanges(@NotNull Collection<TextRange> ranges, int start, int end)