From 18354ca4a70c0d53e4eae1bc53d2daafade6d202 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 26 Jun 2021 18:01:24 +0200 Subject: [PATCH] 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 , which severely impacted performance for some highlighting queries. This uses the `ts_query_cursor_set_match_limit` function introduced in to manually set this back to the old default of 32. Fixes #14897 --- src/nvim/lua/treesitter.c | 1 + 1 file changed, 1 insertion(+) 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);