diff options
author | Thomas Vigouroux <tomvig38@gmail.com> | 2022-01-27 12:46:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 12:46:56 +0100 |
commit | 8c140be31f0d203b63e7052e698fdfe253e0b5d4 (patch) | |
tree | 0d6d9fd106b45cefe23826a9eed4ce92df28eec1 /src/nvim/lua/executor.c | |
parent | f9080b24c4f60c3772db2b6e713ea5a6a3b52f1e (diff) | |
download | rneovim-8c140be31f0d203b63e7052e698fdfe253e0b5d4.tar.gz rneovim-8c140be31f0d203b63e7052e698fdfe253e0b5d4.tar.bz2 rneovim-8c140be31f0d203b63e7052e698fdfe253e0b5d4.zip |
feat(ts): expose minimum language version to lua (#17186)
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index cfdbe7b344..5c4d7e3c91 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -4,6 +4,7 @@ #include <lauxlib.h> #include <lua.h> #include <lualib.h> +#include <tree_sitter/api.h> #include "luv/luv.h" #include "nvim/api/private/defs.h" @@ -1267,6 +1268,12 @@ int tslua_get_language_version(lua_State *L) return 1; } +int tslua_get_minimum_language_version(lua_State *L) +{ + lua_pushnumber(L, TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION); + return 1; +} + static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL { tslua_init(lstate); @@ -1288,6 +1295,9 @@ static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL lua_pushcfunction(lstate, tslua_get_language_version); lua_setfield(lstate, -2, "_ts_get_language_version"); + + lua_pushcfunction(lstate, tslua_get_minimum_language_version); + lua_setfield(lstate, -2, "_ts_get_minimum_language_version"); } int nlua_expand_pat(expand_T *xp, char_u *pat, int *num_results, char_u ***results) |