public static boolean intersects(@NotNull TextRange range, @NotNull PsiElement elem) {
    TextRange elemRange = elem.getTextRange();
    return elemRange != null && elemRange.intersects(range);
  }
public static boolean intersects(@NotNull TextRange range, @NotNull PsiElement elem)