From 1a631026a942b3311adec0bee6d9b0b932c5de31 Mon Sep 17 00:00:00 2001 From: Steven Sojka Date: Wed, 4 Nov 2020 11:03:36 -0600 Subject: feat(treesitter): add language tree Implement the LanguageTree structure to enable language injection. This is done be removing the old Parser metatable and replacing by the new structure, with the same API (almost). Some noticeable differences : - `parser:parse()` now returns a table of trees - There is no incremental parsing for child (injected) languages Co-authored-by: Thomas Vigouroux --- runtime/doc/treesitter.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 58cd535e98..b6a238f158 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -59,15 +59,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 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): > +tsparser:set_included_regions({region_list}) *tsparser:set_included_regions()* + Changes the regions the parser should consider. This is used for + language injection. {region_list} should be of the form (all zero-based): > { - {start_node, end_node}, + {node1, node2}, ... } < - NOTE: `start_node` and `end_node` are both inclusive. + `node1` and `node2` are both considered part of the same region and + will be parsed together with the parser in the same context. Tree methods *lua-treesitter-tree* @@ -253,7 +254,7 @@ Here is a list of built-in predicates : `lua-match?` *ts-predicate-lua-match?* This will match the same way than |match?| but using lua regexes. - + `contains?` *ts-predicate-contains?* Will check if any of the following arguments appears in the text corresponding to the node : > -- cgit