Function: typescript-ts-mode--anchor-decl

typescript-ts-mode--anchor-decl is a byte-compiled function defined in typescript-ts-mode.el.gz.

Signature

(typescript-ts-mode--anchor-decl N PARENT &rest _)

Documentation

Return the position after the declaration keyword before PARENT.

This anchor allows aligning variable_declarators in variable and lexical declarations, accounting for the length of keyword (var, let, or const).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/typescript-ts-mode.el.gz
(defun typescript-ts-mode--anchor-decl (_n parent &rest _)
  "Return the position after the declaration keyword before PARENT.

This anchor allows aligning variable_declarators in variable and lexical
declarations, accounting for the length of keyword (var, let, or const)."
  (let* ((declaration (treesit-parent-until
                       parent (rx (or "variable" "lexical") "_declaration") t))
         (decl (treesit-node-child declaration 0)))
    (+ (treesit-node-start declaration)
       (- (treesit-node-end decl) (treesit-node-start decl)))))