aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2021-03-30 16:40:29 -0400
committerGitHub <noreply@github.com>2021-03-30 16:40:29 -0400
commit240cec9192802db4f166c092428087180e4d3214 (patch)
tree22726ca9f25d60bd34029bdcf5406036946cc81a /src/nvim/lua/executor.c
parentf89bfa68692540c2a28794297ce2ab63892de410 (diff)
downloadrneovim-240cec9192802db4f166c092428087180e4d3214.tar.gz
rneovim-240cec9192802db4f166c092428087180e4d3214.tar.bz2
rneovim-240cec9192802db4f166c092428087180e4d3214.zip
ts: Add language version to vim.treesitter (#14255)
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 310b194c8c..03d178467b 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -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,