From af040c3a079f6e25db0ad6b908aa1327f67deb82 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 11 May 2023 11:13:32 +0100 Subject: feat(treesitter): add support for setting query depths --- runtime/doc/news.txt | 4 ++++ runtime/doc/treesitter.txt | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index bc357ac534..6b1e9112c1 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -29,6 +29,7 @@ The following changes may require adaptations in user config or plugins. set selectmode=mouse,key set mousemodel=popup set keymodel=startsel,stopsel +< ============================================================================== ADDED FEATURES *news-added* @@ -52,6 +53,9 @@ iterators |luaref-in|. • |'smoothscroll'| option to scroll by screen line rather than by text line when |'wrap'| is set. +• |Query:iter_matches()| now has the ability to set the maximum start depth + for matches. + ============================================================================== CHANGED FEATURES *news-changed* diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 0168b11499..d425c8dace 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -939,7 +939,7 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop}) metadata *Query:iter_matches()* -Query:iter_matches({self}, {node}, {source}, {start}, {stop}) +Query:iter_matches({self}, {node}, {source}, {start}, {stop}, {opts}) Iterates the matches of self on a given range. Iterate over all matches within a {node}. The arguments are the same as @@ -966,6 +966,11 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}) • {source} (integer|string) Source buffer or string to search • {start} (integer) Starting line for the search • {stop} (integer) Stopping line for the search (end-exclusive) + • {opts} (table|nil) Options: + • max_start_depth (integer) if non-zero, sets the maximum + start depth for each match. This is used to prevent + traversing too deep into a tree. Requires treesitter >= + 0.20.9. • {self} Return: ~ -- cgit