Function: ruby-ts--comment-font-lock
ruby-ts--comment-font-lock is a byte-compiled function defined in
ruby-ts-mode.el.gz.
Signature
(ruby-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/ruby-ts-mode.el.gz
(defun ruby-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."
;; Empirically it appears as if (treesit-node-start node) will be
;; where the # character is at and (treesit-node-end node) will be
;; the end of the line
(let* ((node-start (treesit-node-start node))
(plus-1 (1+ node-start))
(node-end (treesit-node-end node))
(text (treesit-node-text node t)))
(if (and (>= node-start start)
(<= plus-1 end)
(string-match-p "\\`#" text))
(treesit-fontify-with-override node-start plus-1
font-lock-comment-delimiter-face override))
(treesit-fontify-with-override (max plus-1 start) (min node-end end)
font-lock-comment-face override)))