mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
ts: Add language version to vim.treesitter (#14255)
This commit is contained in:
@@ -1272,6 +1272,12 @@ bool nlua_exec_file(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
int tslua_get_language_version(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, TREE_SITTER_LANGUAGE_VERSION);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
tslua_init(lstate);
|
||||
@@ -1288,8 +1294,11 @@ static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
lua_pushcfunction(lstate, tslua_inspect_lang);
|
||||
lua_setfield(lstate, -2, "_ts_inspect_language");
|
||||
|
||||
lua_pushcfunction(lstate, ts_lua_parse_query);
|
||||
lua_pushcfunction(lstate, tslua_parse_query);
|
||||
lua_setfield(lstate, -2, "_ts_parse_query");
|
||||
|
||||
lua_pushcfunction(lstate, tslua_get_language_version);
|
||||
lua_setfield(lstate, -2, "_ts_get_language_version");
|
||||
}
|
||||
|
||||
int nlua_expand_pat(expand_T *xp,
|
||||
|
@@ -1109,7 +1109,7 @@ static int querycursor_gc(lua_State *L)
|
||||
|
||||
// Query methods
|
||||
|
||||
int ts_lua_parse_query(lua_State *L)
|
||||
int tslua_parse_query(lua_State *L)
|
||||
{
|
||||
if (lua_gettop(L) < 2 || !lua_isstring(L, 1) || !lua_isstring(L, 2)) {
|
||||
return luaL_error(L, "string expected");
|
||||
|
Reference in New Issue
Block a user