@Nullable
  private static PsiElement lowerEndElementIfNeeded(@NotNull PsiElement start, @NotNull PsiElement end) {
    if (PsiTreeUtil.isAncestor(end, start, true)) {
      PsiElement o = end.getLastChild();
      while (o != null && o.getParent() != start.getParent()) {
        PsiElement last = o.getLastChild();
        if (last == null) return o;
        o = last;
      }
      return o;
    }
    return end;
  }
@Nullable
  private static PsiElement lowerEndElementIfNeeded(@NotNull PsiElement start, @NotNull PsiElement end)