Function: lua-ts--comment-font-lock

lua-ts--comment-font-lock is a byte-compiled function defined in lua-ts-mode.el.gz.

Signature

(lua-ts--comment-font-lock NODE OVERRIDE START END &rest _)

Documentation

Apply font lock to comment NODE within START and END.

Applies font-lock-comment-delimiter-face and font-lock-comment-face. See treesit-fontify-with-override for values of OVERRIDE.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-ts-mode.el.gz
(defun lua-ts--comment-font-lock (node override start end &rest _)
  "Apply font lock to comment NODE within START and END.
Applies `font-lock-comment-delimiter-face' and
`font-lock-comment-face'.  See `treesit-fontify-with-override' for
values of OVERRIDE."
  (let* ((node-start (treesit-node-start node))
         (node-end (treesit-node-end node))
         (node-text (treesit-node-text node t))
         (delimiter-end (progn
                          (goto-char node-start)
                          (while (looking-at-p "-") (forward-char))
                          (point))))
    (when (and (>= node-start start)
               (<= delimiter-end end)
               (string-match "\\`---*" node-text))
      (treesit-fontify-with-override node-start
                                     delimiter-end
                                     'font-lock-comment-delimiter-face
                                     override))
    (treesit-fontify-with-override (max delimiter-end start)
                                   (min node-end end)
                                   'font-lock-comment-face
                                   override)))