Function: php-ts-mode--anchor-first-sibling

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

Signature

(php-ts-mode--anchor-first-sibling NODE PARENT BOL &rest _)

Documentation

Return the start of the first child of a sibling of PARENT.

If the fist sibling of PARENT and the first child of the sibling are on the same line return the start position of the first child of the sibling. Otherwise return the start of the first sibling. PARENT is NODE's parent, BOL is the beginning of non-whitespace characters of the current line.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/php-ts-mode.el.gz
(defun php-ts-mode--anchor-first-sibling (_node parent _bol &rest _)
  "Return the start of the first child of a sibling of PARENT.

If the fist sibling of PARENT and the first child of the sibling are
on the same line return the start position of the first child of the
sibling.  Otherwise return the start of the first sibling.
PARENT is NODE's parent, BOL is the beginning of non-whitespace
characters of the current line."
  (let ((first-sibling-start
         (treesit-node-start (treesit-node-child parent 0)))
        (first-sibling-child-start
         (treesit-node-start (treesit-node-child parent 1))))
    (if (equal
         (line-number-at-pos first-sibling-start)
         (line-number-at-pos first-sibling-child-start))
        ;; if are on the same line return the child start
        first-sibling-child-start
      first-sibling-start)))