Function: treesit--indent-1
treesit--indent-1 is a byte-compiled function defined in
treesit.el.gz.
Signature
(treesit--indent-1)
Documentation
Indent the current line.
Return (ANCHOR . OFFSET). This function is used by
treesit-indent and treesit-indent-region.
Source Code
;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit--indent-1 ()
"Indent the current line.
Return (ANCHOR . OFFSET). This function is used by
`treesit-indent' and `treesit-indent-region'."
;; Basically holds the common part between the two indent function.
(let* ((bol (save-excursion
(forward-line 0)
(skip-chars-forward " \t")
(point)))
(node (treesit--indent-largest-node-at bol))
(parser (if node
(treesit-node-parser node)
nil))
;; NODE would be nil if BOL is on a whitespace. In that case
;; we set PARENT to the "node at point", which would
;; encompass the whitespace.
(parent (cond ((and node parser)
(treesit-node-parent node))
(t (treesit-node-on bol bol)))))
(funcall treesit-indent-function node parent bol)))