Browse Source

Merge pull request #13075 from vigoux/ts-check-parser-version

treesitter: check language ABI version on load
pull/13081/head
Thomas Vigouroux 4 months ago
committed by GitHub
parent
commit
ce5a260c9e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      src/nvim/lua/treesitter.c

+ 8
- 0
src/nvim/lua/treesitter.c View File

@ -174,6 +174,14 @@ int tslua_add_language(lua_State *L)
return luaL_error(L, "Failed to load parser: internal error");
}
uint32_t lang_version = ts_language_version(lang);
if (lang_version < TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION) {
return luaL_error(
L,
"ABI version mismatch : expected %" PRIu32 ", found %" PRIu32,
TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION, lang_version);
}
pmap_put(cstr_t)(langs, xstrdup(lang_name), lang);
lua_pushboolean(L, true);


Loading…
Cancel
Save