Function: typescript-ts--standalone-parent-p
typescript-ts--standalone-parent-p is a byte-compiled function defined
in typescript-ts-mode.el.gz.
Signature
(typescript-ts--standalone-parent-p PARENT)
Documentation
Return t if PARENT can be considered standalone.
This is used for treesit-simple-indent-standalone-predicate.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/typescript-ts-mode.el.gz
(defun typescript-ts--standalone-parent-p (parent)
"Return t if PARENT can be considered standalone.
This is used for `treesit-simple-indent-standalone-predicate'."
(save-excursion
(goto-char (treesit-node-start parent))
(cond
;; Never allow nested ternary_expression node to be standalone
;; parent, to avoid nested indentation.
((equal (treesit-node-type (treesit-node-parent parent))
"ternary_expression")
nil)
;; If there's only whitespace before node, consider
;; this node standalone. To support function
;; chaining, allow a dot to be before the node.
((looking-back (rx bol (* whitespace) (? "."))
(line-beginning-position))
(if (looking-back "\\." (max (point-min) (1- (point))))
(1- (point))
(point))))))