private static @NotNull LeafBlockWrapper adjustAtLanguageBorder(@NotNull LeafBlockWrapper current, final int offset) {
    if (!current.contains(offset)) {
      final LeafBlockWrapper previousBlock = current.getPreviousBlock();
      if (previousBlock != null && !previousBlock.contains(offset) &&
          !Objects.equals(previousBlock.getLanguage(), current.getLanguage())) {
        AbstractBlockWrapper prevParent = getParentFor(offset, (AbstractBlockWrapper)previousBlock);
        if (prevParent != null && prevParent.getEndOffset() <= current.getStartOffset()) {
          return previousBlock;
        }
      }
    }
    return current;
  }
private static @NotNull LeafBlockWrapper adjustAtLanguageBorder(@NotNull LeafBlockWrapper current, final int offset)