private static @Nullable PsiComment findCommentUnderCaret(@NotNull Editor editor, @NotNull PsiFile file) {
    final PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
    return PsiTreeUtil.getParentOfType(element, PsiComment.class, false);
  }
private static @Nullable PsiComment findCommentUnderCaret(@NotNull Editor editor, @NotNull PsiFile file)