private static boolean isInvalidOffset(@NotNull PsiFile file, int offset) {
               PsiElement element = file.findElementAt(offset);
               return element == null || !element.getTextRange().contains(offset);
             }
private static boolean isInvalidOffset(@NotNull PsiFile file, int offset)