aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/treesitter.c
diff options
context:
space:
mode:
authorChristian Clason <christian.clason@uni-due.de>2021-06-26 18:01:24 +0200
committerChristian Clason <christian.clason@uni-due.de>2021-06-26 18:11:38 +0200
commit18354ca4a70c0d53e4eae1bc53d2daafade6d202 (patch)
treed96c4a83ac00c6725740b836e7934c25f7ea9f8e /src/nvim/lua/treesitter.c
parentc1120ad0e1adf8b34ee10b63b2134fcb0d580fce (diff)
downloadrneovim-18354ca4a70c0d53e4eae1bc53d2daafade6d202.tar.gz
rneovim-18354ca4a70c0d53e4eae1bc53d2daafade6d202.tar.bz2
rneovim-18354ca4a70c0d53e4eae1bc53d2daafade6d202.zip
fix(treesitter): set match limit for query cursors
Upstream tree-sitter raised the number of pending matches for a query cursor from 32 to 64k in <https://github.com/tree-sitter/tree-sitter/commit/ 78010722a49ed6224c773c22b0d25a8c9fbde584>, which severely impacted performance for some highlighting queries. This uses the `ts_query_cursor_set_match_limit` function introduced in <https://github.com/tree-sitter/tree-sitter/commit/ cd96552448a6e0d4eb27fc54b27cb5130c4b6f76> to manually set this back to the old default of 32. Fixes #14897
Diffstat (limited to 'src/nvim/lua/treesitter.c')
-rw-r--r--src/nvim/lua/treesitter.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index c186928ae2..11d30aae09 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -1073,6 +1073,7 @@ 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();
+ ts_query_cursor_set_match_limit(cursor, 32);
ts_query_cursor_exec(cursor, query, node);
bool captures = lua_toboolean(L, 3);