diff options
Diffstat (limited to 'src/nvim/lua')
| -rw-r--r-- | src/nvim/lua/treesitter.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c index fa5cf1118d..a346bf5963 100644 --- a/src/nvim/lua/treesitter.c +++ b/src/nvim/lua/treesitter.c @@ -1491,6 +1491,8 @@ static struct luaL_Reg query_meta[] = { { "__gc", query_gc }, { "__tostring", query_tostring }, { "inspect", query_inspect }, + { "disable_capture", query_disable_capture }, + { "disable_pattern", query_disable_pattern }, { NULL, NULL } }; @@ -1689,6 +1691,23 @@ static int query_inspect(lua_State *L) return 1; } +static int query_disable_capture(lua_State *L) +{ + TSQuery *query = query_check(L, 1); + size_t name_len; + const char *name = luaL_checklstring(L, 2, &name_len); + ts_query_disable_capture(query, name, (uint32_t)name_len); + return 0; +} + +static int query_disable_pattern(lua_State *L) +{ + TSQuery *query = query_check(L, 1); + const uint32_t pattern_index = (uint32_t)luaL_checkinteger(L, 2); + ts_query_disable_pattern(query, pattern_index - 1); + return 0; +} + // Library init static void build_meta(lua_State *L, const char *tname, const luaL_Reg *meta) |
