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

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

Signature

(php-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/php-ts-mode.el.gz
;; taken from c-ts-mode
(defun php-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))))))