private List<PsiElement> grabCommentsBefore(@NotNull PsiElement element) {
    if (lastTextWithCommentsElement == null) {
      lastTextWithCommentsElement = element;
      return Collections.emptyList();
    }
    List<PsiElement> result = new SmartList<>();
    int start = lastTextWithCommentsElement.getTextRange().getEndOffset();
    int end = element.getTextRange().getStartOffset();
    PsiElement parent = PsiTreeUtil.findCommonParent(lastTextWithCommentsElement, element);
    if (parent != null && start < end) {
      PsiTreeUtil.processElements(parent, e -> {
        if (e instanceof PsiComment) {
          TextRange range = e.getTextRange();
          if (range.getStartOffset() >= start && range.getEndOffset() <= end && !shouldIgnore((PsiComment)e)) {
            result.add(e);
          }
        }
        return true;
      });
    }

    lastTextWithCommentsElement = element;
    return result;
  }
private List<PsiElement> grabCommentsBefore(@NotNull PsiElement element)