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
This commit is contained in:
Christian Clason 2021-06-26 18:01:24 +02:00
parent c1120ad0e1
commit 18354ca4a7

View File

@ -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);