Function: treesit-local-parsers-at
treesit-local-parsers-at is a byte-compiled function defined in
treesit.el.gz.
Signature
(treesit-local-parsers-at &optional POS LANGUAGE WITH-HOST)
Documentation
Return all the local parsers at POS.
POS defaults to point.
Local parsers are those which only parse a limited region marked
by an overlay with non-nil treesit-parser property.
If LANGUAGE is non-nil, only return parsers for LANGUAGE.
If WITH-HOST is non-nil, return a list of (PARSER . HOST-PARSER) instead. HOST-PARSER is the host parser which created the local PARSER.
Source Code
;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-local-parsers-at (&optional pos language with-host)
"Return all the local parsers at POS.
POS defaults to point.
Local parsers are those which only parse a limited region marked
by an overlay with non-nil `treesit-parser' property.
If LANGUAGE is non-nil, only return parsers for LANGUAGE.
If WITH-HOST is non-nil, return a list of (PARSER . HOST-PARSER)
instead. HOST-PARSER is the host parser which created the local
PARSER."
(let ((res nil))
(dolist (ov (overlays-at (or pos (point))))
(when-let ((parser (overlay-get ov 'treesit-parser))
(host-parser (overlay-get ov 'treesit-host-parser)))
(when (or (null language)
(eq (treesit-parser-language parser)
language))
(push (if with-host (cons parser host-parser) parser) res))))
(nreverse res)))