(`vim.treesitter.LanguageTree?`)
LanguageTree:parse({range}, {on_parse}) *LanguageTree:parse()*
Recursively parse all regions in the language tree using
|treesitter-parsers| for the corresponding languages and run injection
queries on the parsed trees to determine whether child trees should be
created and parsed.
Any region with empty range (`{}`, typically only the root tree) is always
parsed; otherwise (typically injections) only if it intersects {range} (or
if {range} is `true`).
Parameters: ~
• {range} (`boolean|Range?`) Parse this range in the parser's
source. Set to `true` to run a complete parse of the
source (Note: Can be slow!) Set to `false|nil` to only
parse regions with empty ranges (typically only the root
tree without injections).
• {on_parse} (`fun(err?: string, trees?: table<integer, TSTree>)?`)
Function invoked when parsing completes. When provided and
`vim.g._ts_force_sync_parsing` is not set, parsing will
run asynchronously. The first argument to the function is
a string representing the error type, in case of a failure
(currently only possible for timeouts). The second
argument is the list of trees returned by the parse (upon
success), or `nil` if the parse timed out (determined by
'redrawtime').
If parsing was still able to finish synchronously (within
3ms), `parse()` returns the list of trees. Otherwise, it
returns `nil`.
Return: ~
(`table<integer, TSTree>?`)
*LanguageTree:register_cbs()*
LanguageTree:register_cbs({cbs}, {recursive})
Registers callbacks for the |LanguageTree|.
Parameters: ~
• {cbs} (`table<TSCallbackNameOn,function>`) An
|nvim_buf_attach()|-like table argument with the
following handlers:
• `on_bytes` : see |nvim_buf_attach()|.