Function: js--treesit-switch-body-helper
js--treesit-switch-body-helper is a byte-compiled function defined in
js.el.gz.
Signature
(js--treesit-switch-body-helper NODE PARENT BOL &rest ARGS)
Documentation
Anchor helper for the switch body..
If "{" is on a newline return the PARENT bol plus an offset,
otherwise return the usual parent-bol value. If js-switch-indent-offset > 0
this is the offset, otherwise is js-indent-level.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--treesit-switch-body-helper (_node parent _bol &rest _args)
"Anchor helper for the switch body..
If \"{\" is on a newline return the PARENT bol plus an offset,
otherwise return the usual `parent-bol' value. If `js-switch-indent-offset' > 0
this is the offset, otherwise is `js-indent-level'."
(save-excursion
(goto-char (treesit-node-start parent))
(back-to-indentation)
(if (not (eq ?{ (char-after)))
(+ (point) js-switch-indent-offset)
(let ((offset ; offset relative to "{"
(if (= js-switch-indent-offset 0)
js-indent-level
js-switch-indent-offset))
(pos ; position relative to the "statement_block"
(treesit-node-start
(treesit-node-parent
parent))))
(+ pos offset)))))