private static @NotNull List<PsiStatement> extractStatements(PsiFile file, TextRange range) {
      int startOffset = range.getStartOffset();
      int endOffset = range.getEndOffset();
      PsiElement[] elements = CodeInsightUtil.findStatementsInRange(file, startOffset, endOffset);
      return StreamEx.of(elements)
        .map(e -> tryCast(e, PsiStatement.class))
        .collect(MoreCollectors.ifAllMatch(LoopModel::isAllowedStatement, Collectors.toList()))
        .orElse(Collections.emptyList());
    }
private static @NotNull List<PsiStatement> extractStatements(PsiFile file, TextRange range)