mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 11:25:33 +00:00
treesitter: add some documentation for parsers
This commit is contained in:
@@ -512,6 +512,9 @@ retained for the lifetime of a buffer but this is subject to change. A plugin
|
|||||||
should keep a reference to the parser object as long as it wants incremental
|
should keep a reference to the parser object as long as it wants incremental
|
||||||
updates.
|
updates.
|
||||||
|
|
||||||
|
Parser methods *lua-treesitter-parser*
|
||||||
|
|
||||||
|
tsparser:parse() *tsparser:parse()*
|
||||||
Whenever you need to access the current syntax tree, parse the buffer: >
|
Whenever you need to access the current syntax tree, parse the buffer: >
|
||||||
|
|
||||||
tstree = parser:parse()
|
tstree = parser:parse()
|
||||||
@@ -528,6 +531,16 @@ shouldn't be done directly in the change callback anyway as they will be very
|
|||||||
frequent. Rather a plugin that does any kind of analysis on a tree should use
|
frequent. Rather a plugin that does any kind of analysis on a tree should use
|
||||||
a timer to throttle too frequent updates.
|
a timer to throttle too frequent updates.
|
||||||
|
|
||||||
|
tsparser:set_included_ranges(ranges) *tsparser:set_included_ranges()*
|
||||||
|
Changes the ranges the parser should consider. This is used for
|
||||||
|
language injection. `ranges` should be of the form (all zero-based): >
|
||||||
|
{
|
||||||
|
{start_node, end_node},
|
||||||
|
...
|
||||||
|
}
|
||||||
|
<
|
||||||
|
NOTE: `start_node` and `end_node` are both inclusive.
|
||||||
|
|
||||||
Tree methods *lua-treesitter-tree*
|
Tree methods *lua-treesitter-tree*
|
||||||
|
|
||||||
tstree:root() *tstree:root()*
|
tstree:root() *tstree:root()*
|
||||||
|
|||||||
Reference in New Issue
Block a user