private static PsiElement getTopmostParentAfterOffset(PsiElement element, int offset) {
    if (element == null) return null;
    while (true) {
      final PsiElement parent = element.getParent();
      if (parent == null || (parent.getTextRange().getStartOffset() < offset)) {
        return element;
      }
      element = parent;
    }
  }
private static PsiElement getTopmostParentAfterOffset(PsiElement element, int offset)