feat(treesitter): set allocator when possible

Adds a new cmake check to keep this backwards compatible with the
different versions of tree-sitter.
This commit is contained in:
Thomas Vigouroux
2022-01-09 10:13:49 +00:00
parent c7ffe406bc
commit b1e0aa60f9
2 changed files with 17 additions and 0 deletions

View File

@@ -129,6 +129,10 @@ void tslua_init(lua_State *L)
build_meta(L, TS_META_QUERY, query_meta);
build_meta(L, TS_META_QUERYCURSOR, querycursor_meta);
build_meta(L, TS_META_TREECURSOR, treecursor_meta);
#ifdef NVIM_TS_HAS_SET_ALLOCATOR
ts_set_allocator(xmalloc, xcalloc, xrealloc, xfree);
#endif
}
int tslua_has_language(lua_State *L)