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()|.
• `on_changedtree` : a callback that will be called every
time the tree has syntactical changes. It will be
passed two arguments: a table of the ranges (as node
ranges) that changed and the changed tree.
• `on_child_added` : emitted when a child is added to the
tree.
• `on_child_removed` : emitted when a child is removed
from the tree.
• `on_detach` : emitted when the buffer is detached, see
|nvim_buf_detach_event|. Takes one argument, the number
of the buffer.
• {recursive} (`boolean?`) Apply callbacks recursively for all
children. Any new children will also inherit the
callbacks.
LanguageTree:source() *LanguageTree:source()*
Returns the source content of the language tree (bufnr or string).
Return: ~
(`integer|string`)
*LanguageTree:tree_for_range()*
LanguageTree:tree_for_range({range}, {opts})
Gets the tree that contains {range}.
Parameters: ~
• {range} (`table`) A table with the following fields:
• {[1]} (`integer`) start row
• {[2]} (`integer`) start column
• {[3]} (`integer`) end row
• {[4]} (`integer`) end column
• {opts} (`table?`) A table with the following fields:
• {ignore_injections}? (`boolean`, default: `true`) Ignore
injected languages
Return: ~
(`TSTree?`)
LanguageTree:trees() *LanguageTree:trees()*
Returns all trees of the regions parsed by this parser. Does not include
child languages. The result is list-like if
• this LanguageTree is the root, in which case the result is empty or a
singleton list; or
• the root LanguageTree is fully parsed.
Return: ~
(`table<integer, TSTree>`)
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: