diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2025-05-11 09:14:57 +0100 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2025-05-13 15:44:42 +0100 |
| commit | 40b64e91007e364fd7c7eaab64ce7c8cf0150aec (patch) | |
| tree | 80e5a51855b00c3081f752c816351a739d0f60c9 /src/nvim/lua/executor.c | |
| parent | cc78f882012baa4d0bdca65c8dfbbd3a24e03187 (diff) | |
refactor(treesitter): move functions from executor.c to treesitter.c
Diffstat (limited to 'src/nvim/lua/executor.c')
| -rw-r--r-- | src/nvim/lua/executor.c | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 617921efd6..fc11d2b966 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -820,7 +820,7 @@ static bool nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL } // internal vim._treesitter... API - nlua_add_treesitter(lstate); + nlua_treesitter_init(lstate); nlua_state_add_stdlib(lstate, false); @@ -938,7 +938,7 @@ void nlua_free_all_mem(void) lua_State *lstate = global_lstate; nlua_unref_global(lstate, require_ref); nlua_common_free_all_mem(lstate); - tslua_free(); + nlua_treesitter_free(); } static void nlua_common_free_all_mem(lua_State *lstate) @@ -1870,55 +1870,6 @@ 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; -} - -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); - - lua_pushcfunction(lstate, tslua_push_parser); - lua_setfield(lstate, -2, "_create_ts_parser"); - - lua_pushcfunction(lstate, tslua_push_querycursor); - lua_setfield(lstate, -2, "_create_ts_querycursor"); - - lua_pushcfunction(lstate, tslua_add_language_from_object); - lua_setfield(lstate, -2, "_ts_add_language_from_object"); - -#ifdef HAVE_WASMTIME - lua_pushcfunction(lstate, tslua_add_language_from_wasm); - lua_setfield(lstate, -2, "_ts_add_language_from_wasm"); -#endif - - lua_pushcfunction(lstate, tslua_has_language); - lua_setfield(lstate, -2, "_ts_has_language"); - - lua_pushcfunction(lstate, tslua_remove_lang); - lua_setfield(lstate, -2, "_ts_remove_language"); - - lua_pushcfunction(lstate, tslua_inspect_lang); - lua_setfield(lstate, -2, "_ts_inspect_language"); - - 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"); - - lua_pushcfunction(lstate, tslua_get_minimum_language_version); - lua_setfield(lstate, -2, "_ts_get_minimum_language_version"); -} - static garray_T expand_result_array = GA_EMPTY_INIT_VALUE; /// Finds matches for Lua cmdline completion and advances xp->xp_pattern after prefix. |
