aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/treesitter.c
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-06-07 14:19:38 +0200
committerThomas Vigouroux <tomvig38@gmail.com>2020-06-23 09:11:41 +0200
commit36d71e775a44526abd70b2720a589a1113c650d7 (patch)
tree50e7315889c04fde61cc0f367051ee0893993009 /src/nvim/lua/treesitter.c
parent721f69c4af8bc81ba04088e7b56f8cdba653b418 (diff)
downloadrneovim-36d71e775a44526abd70b2720a589a1113c650d7.tar.gz
rneovim-36d71e775a44526abd70b2720a589a1113c650d7.tar.bz2
rneovim-36d71e775a44526abd70b2720a589a1113c650d7.zip
treesitter: simplify puhstree call process
Diffstat (limited to 'src/nvim/lua/treesitter.c')
-rw-r--r--src/nvim/lua/treesitter.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index 51d9549033..3447af9114 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -214,8 +214,14 @@ int tslua_inspect_lang(lua_State *L)
return 1;
}
-int tslua_push_parser(lua_State *L, const char *lang_name)
+int tslua_push_parser(lua_State *L)
{
+
+ // Gather language
+ if (lua_gettop(L) < 1 || !lua_isstring(L, 1)) {
+ return luaL_error(L, "string expected");
+ }
+ const char *lang_name = lua_tostring(L, 1);
TSLanguage *lang = pmap_get(cstr_t)(langs, lang_name);
if (!lang) {
return luaL_error(L, "no such language: %s", lang_name);