LeafBlockWrapper (@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; }