private @Nullable TextRange intersectWithEditable(@NotNull TextRange rangeToEdit) {
    int startOffset = -1;
    int endOffset = -1;
    synchronized (myLock) {
      int offset = 0;
      for (PsiLanguageInjectionHost.Shred shred : myShreds) {
        Segment hostRange = shred.getHostRangeMarker();
        if (hostRange == null) continue;
        offset += shred.getPrefix().length();
        int length = hostRange.getEndOffset() - hostRange.getStartOffset();
        TextRange intersection = new ProperTextRange(offset, offset + length).intersection(rangeToEdit);
        if (intersection != null) {
          if (startOffset == -1) {
            startOffset = intersection.getStartOffset();
          }
          endOffset = intersection.getEndOffset();
        }
        offset += length;
        offset += shred.getSuffix().length();
      }
    }
    if (startOffset == -1) return null;
    return new ProperTextRange(startOffset, endOffset);
  }
private @Nullable TextRange intersectWithEditable(@NotNull TextRange rangeToEdit)