aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Clason <christian.clason@uni-due.de>2021-06-29 15:59:57 +0200
committerChristian Clason <christian.clason@uni-due.de>2021-06-29 17:15:12 +0200
commit7e8a8482e8e474b9ec45c1bd147dd0b0f4ff03af (patch)
treea8081ab7e80aafadfb87590a424156f3acb5dcba /src
parentf83c25942dd8b94ad5218ce78b9e6fb86d2f0358 (diff)
downloadrneovim-7e8a8482e8e474b9ec45c1bd147dd0b0f4ff03af.tar.gz
rneovim-7e8a8482e8e474b9ec45c1bd147dd0b0f4ff03af.tar.bz2
rneovim-7e8a8482e8e474b9ec45c1bd147dd0b0f4ff03af.zip
fixup(ts): put ts_query_cursor_set_match_limit behind feature guard
This is a fixup for #14915, which used the above-mentioned call to restore the behavior of the pre-release version of tree-sitter to that of 0.19.5. However, this function was introduced after 0.19.5, breaking distro builds that link against 0.19.5 instead of the tag specified in neovim's build script. Now the function should only be called when it is available _and_ needed. Once tree-sitter is bumped to 0.19.6 (when this is released), this guard can be removed again. Fixes #14923 (among others)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/lua/treesitter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index 11d30aae09..e3fa48f530 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -1073,7 +1073,11 @@ static int node_rawquery(lua_State *L)
// TODO(bfredl): these are expensive allegedly,
// use a reuse list later on?
TSQueryCursor *cursor = ts_query_cursor_new();
+ // TODO(clason): API introduced after tree-sitter release 0.19.5
+ // remove guard when minimum ts version is bumped to 0.19.6+
+#ifdef NVIM_TS_HAS_SET_MATCH_LIMIT
ts_query_cursor_set_match_limit(cursor, 32);
+#endif
ts_query_cursor_exec(cursor, query, node);
bool captures = lua_toboolean(L, 3);