pub trait LanguageImpl {
// Required methods
fn get_tree_sitter_language(&self) -> TSLanguage;
fn is_acceptable_parent(&self, node: &Node<'_>) -> bool;
fn is_test_node(&self, node: &Node<'_>, source: &[u8]) -> bool;
fn get_extension(&self) -> &'static str;
// Provided method
fn find_parent_function<'a>(&self, _node: Node<'a>) -> Option<Node<'a>> { ... }
}
Expand description
Trait that defines the interface for all language implementations.
Required Methodsยง
Sourcefn get_tree_sitter_language(&self) -> TSLanguage
fn get_tree_sitter_language(&self) -> TSLanguage
Get the tree-sitter language for parsing
Sourcefn is_acceptable_parent(&self, node: &Node<'_>) -> bool
fn is_acceptable_parent(&self, node: &Node<'_>) -> bool
Check if a node is an acceptable container/parent entity
Sourcefn is_test_node(&self, node: &Node<'_>, source: &[u8]) -> bool
fn is_test_node(&self, node: &Node<'_>, source: &[u8]) -> bool
Check if a node represents a test
Sourcefn get_extension(&self) -> &'static str
๐Deprecated since 0.1.0: this method is not used
fn get_extension(&self) -> &'static str
Get the file extension for this language
Provided Methodsยง
Sourcefn find_parent_function<'a>(&self, _node: Node<'a>) -> Option<Node<'a>>
fn find_parent_function<'a>(&self, _node: Node<'a>) -> Option<Node<'a>>
Find the parent function or method declaration for a node (if any)