Function: treesit--likely-line-comment-p

treesit--likely-line-comment-p is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit--likely-line-comment-p NODE)

Documentation

Return non-nil if NODE is likely a line comment.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit--likely-line-comment-p (node)
  "Return non-nil if NODE is likely a line comment."
  (save-excursion
    (goto-char (treesit-node-start node))
    (if comment-start-line-regexp
        (looking-at-p comment-start-line-regexp)
      ;; Without `comment-start-line-regexp', it's kind of best-effort.
      (and comment-start
           ;; If `comment-end' is non-empty, `comment-start' must be
           ;; paired with it.
           (string-empty-p (string-trim (or comment-end "")))
           (looking-at-p (regexp-quote (string-trim-right comment-start)))))))