Variable: treesit-range-settings
treesit-range-settings is a buffer-local variable defined in
treesit.el.gz.
Documentation
A list of range settings.
Each element of the list is of the form
(QUERY LANGUAGE LOCAL-P OFFSET RANGE-FN)
When updating the range of each parser in the buffer,
treesit-update-ranges queries each QUERY, and sets LANGUAGE's range to
the range spanned by captured nodes. QUERY must be a compiled query.
If LOCAL-P is t, give each range a separate local parser rather than
using a single parser for all the ranges. If OFFSET is non-nil, it
should be a cons of numbers (START-OFFSET . END-OFFSET), where the start
and end offset are added to each queried range to get the result ranges.
If RANGE-FN is non-nil, it should be a function; Emacs uses this function to compute the ranges to use for the embedded parser. The function is passed the captured node and OFFSET, and should return a list of ranges, where each range is a cons of the start and end position.
Capture names generally don't matter, but names that start with an underscore are ignored.
QUERY can also be a function, in which case it is called with 2 arguments, START and END. It should ensure parsers' ranges are correct in the region between START and END.
The exact form of each setting is considered internal and subject
to change. Use treesit-range-rules to set this variable.
Source Code
;; Defined in /usr/src/emacs/lisp/treesit.el.gz
;;; Range API supplement
;; (ref:local-parser-overlay) Regarding local parser overlays, we store
;; the local parser in an overlay spanning across the code block for
;; which the parser is responsible. The `treesit-parser' property stores
;; the parser, the `treesit-host-parser' property stores the host parser,
;; the `treesit-parser-ov-timestamp' property stores the buffer's tick
;; counter (`buffer-modified-tick') when we last updated this overlay,
;; which is used for garbage-collecting stale ranges and local parsers.
;;
;; Besides local parsers, we also create overlays for non-local parsers,
;; just to mark the start and end of each range they parse, so that other
;; functions can make use of this information. To differentiate the
;; overlay for local and non-local parsers, local parsers' overlays have
;; the `treesit-parser-local-p' property set to non-nil.
(defvar-local treesit-range-settings nil
"A list of range settings.
Each element of the list is of the form
(QUERY LANGUAGE LOCAL-P OFFSET RANGE-FN)
When updating the range of each parser in the buffer,
`treesit-update-ranges' queries each QUERY, and sets LANGUAGE's range to
the range spanned by captured nodes. QUERY must be a compiled query.
If LOCAL-P is t, give each range a separate local parser rather than
using a single parser for all the ranges. If OFFSET is non-nil, it
should be a cons of numbers (START-OFFSET . END-OFFSET), where the start
and end offset are added to each queried range to get the result ranges.
If RANGE-FN is non-nil, it should be a function; Emacs uses this
function to compute the ranges to use for the embedded parser. The
function is passed the captured node and OFFSET, and should return a
list of ranges, where each range is a cons of the start and end
position.
Capture names generally don't matter, but names that start with
an underscore are ignored.
QUERY can also be a function, in which case it is called with 2
arguments, START and END. It should ensure parsers' ranges are
correct in the region between START and END.
The exact form of each setting is considered internal and subject
to change. Use `treesit-range-rules' to set this variable.")