rust: Add Language::node_kind_is_visible API

This commit is contained in:
Max Brunsfeld 2020-01-31 12:04:18 -08:00
parent ee7c29346a
commit a1c3de1b99

View file

@ -200,6 +200,12 @@ impl Language {
unsafe { ffi::ts_language_symbol_type(self.0, id) == ffi::TSSymbolType_TSSymbolTypeRegular }
}
pub fn node_kind_is_visible(&self, id: u16) -> bool {
unsafe {
ffi::ts_language_symbol_type(self.0, id) <= ffi::TSSymbolType_TSSymbolTypeAnonymous
}
}
/// Get the number of distinct field names in this language.
pub fn field_count(&self) -> usize {
unsafe { ffi::ts_language_field_count(self.0) as usize }