Function: js--treesit-arrow-function-helper

js--treesit-arrow-function-helper is a byte-compiled function defined in js.el.gz.

Signature

(js--treesit-arrow-function-helper NODE PARENT BOL &rest ARGS)

Documentation

Anchor helper for arrow_function, return a position based on context.

If and arrow function has a variable_declarator ancestor, returns the same value of grand-parent otherwise return parent-bol plus js-indent-level. 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/js.el.gz
(defun js--treesit-arrow-function-helper (node parent bol &rest args)
  "Anchor helper for arrow_function, return a position based on context.
If and arrow function has a variable_declarator ancestor, returns the
same value of `grand-parent' otherwise return `parent-bol' plus
`js-indent-level'.
PARENT is NODE's parent, BOL is the beginning of non-whitespace
characters of the current line."
  (if-let* ((ancestor-node
	     (treesit-parent-until
	      parent
	      "variable_declarator")))
      (apply (alist-get 'grand-parent treesit-simple-indent-presets)
             node parent bol args)
    (+ (apply (alist-get 'parent-bol treesit-simple-indent-presets)
              node parent bol args)
       js-indent-level)))