public static boolean containsOffsetInElement(@NotNull PsiReference ref, int offset) {
    if (ref instanceof MultiRangeReference) {
      for (TextRange range : ((MultiRangeReference)ref).getRanges()) {
        if (range.containsOffset(offset)) return true;
      }

      return false;
    }
    return ref.getRangeInElement().containsOffset(offset);
  }
public static boolean containsOffsetInElement(@NotNull PsiReference ref, int offset)