Function ts_language_abi_checked

Source
pub fn ts_language_abi_checked(
    ts_language: &Language,
) -> Result<(), LoadingError>
Expand description

A convenience function to check of a tree-sitter language has a compatible ABI version for diffsitter.

Diffsitter has a version of the tree-sitter library it’s build against and that library supports a certain range of tree-sitter ABIs. Each compiled tree-sitter grammar reports its ABI version, so we can check whether the ABI versions are compatible before loading the grammar as a tree-sitter parser, which should prevent segfaults due to these sorts of mismatches.