diff options
Diffstat (limited to 'src/nvim/lua')
-rw-r--r-- | src/nvim/lua/executor.c | 10 | ||||
-rw-r--r-- | src/nvim/lua/treesitter.c | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index afc387ef38..4d4286354b 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1164,6 +1164,13 @@ static void nlua_typval_exec(const char *lcmd, size_t lcmd_len, int nlua_source_using_linegetter(LineGetter fgetline, void *cookie, char *name) { + const linenr_T save_sourcing_lnum = sourcing_lnum; + const sctx_T save_current_sctx = current_sctx; + current_sctx.sc_sid = SID_STR; + current_sctx.sc_seq = 0; + current_sctx.sc_lnum = 0; + sourcing_lnum = 0; + garray_T ga; char_u *line = NULL; @@ -1174,6 +1181,9 @@ int nlua_source_using_linegetter(LineGetter fgetline, char *code = (char *)ga_concat_strings_sep(&ga, "\n"); size_t len = strlen(code); nlua_typval_exec(code, len, name, NULL, 0, false, NULL); + + sourcing_lnum = save_sourcing_lnum; + current_sctx = save_current_sctx; ga_clear_strings(&ga); xfree(code); return OK; diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c index c186928ae2..e3fa48f530 100644 --- a/src/nvim/lua/treesitter.c +++ b/src/nvim/lua/treesitter.c @@ -1073,6 +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); |