Function: c-ts-mode--first-sibling

c-ts-mode--first-sibling is a byte-compiled function defined in c-ts-mode.el.gz.

Signature

(c-ts-mode--first-sibling NODE PARENT &rest _)

Documentation

Matches when NODE is the "first sibling".

"First sibling" is defined as: the first child node of PARENT
such that it's on its own line. NODE is the node to match and PARENT is its parent.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--first-sibling (node parent &rest _)
  "Matches when NODE is the \"first sibling\".
\"First sibling\" is defined as: the first child node of PARENT
such that it's on its own line.  NODE is the node to match and
PARENT is its parent."
  (let ((prev-sibling (treesit-node-prev-sibling node t)))
    (or (null prev-sibling)
        (save-excursion
          (goto-char (treesit-node-start prev-sibling))
          (<= (line-beginning-position)
              (treesit-node-start parent)
              (line-end-position))))))