mirror of
https://github.com/neovim/neovim.git
synced 2024-12-27 14:21:31 -07:00
Fix(treesitter): Make treesitter.inspect_lang include last field name
This commit is contained in:
parent
a1a0bc618f
commit
927475bdf0
@ -222,8 +222,9 @@ int tslua_inspect_lang(lua_State *L)
|
||||
lua_setfield(L, -2, "symbols"); // [retval]
|
||||
|
||||
size_t nfields = (size_t)ts_language_field_count(lang);
|
||||
lua_createtable(L, nfields-1, 1); // [retval, fields]
|
||||
for (size_t i = 0; i < nfields; i++) {
|
||||
lua_createtable(L, nfields, 1); // [retval, fields]
|
||||
// Field IDs go from 1 to nfields inclusive (extra index 0 maps to NULL)
|
||||
for (size_t i = 1; i <= nfields; i++) {
|
||||
lua_pushstring(L, ts_language_field_name_for_id(lang, i));
|
||||
lua_rawseti(L, -2, i); // [retval, fields]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user