Trait LanguageImpl

Source
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ยง

Source

fn get_tree_sitter_language(&self) -> TSLanguage

Get the tree-sitter language for parsing

Source

fn is_acceptable_parent(&self, node: &Node<'_>) -> bool

Check if a node is an acceptable container/parent entity

Source

fn is_test_node(&self, node: &Node<'_>, source: &[u8]) -> bool

Check if a node represents a test

Source

fn get_extension(&self) -> &'static str

๐Ÿ‘ŽDeprecated since 0.1.0: this method is not used

Get the file extension for this language

Provided Methodsยง

Source

fn find_parent_function<'a>(&self, _node: Node<'a>) -> Option<Node<'a>>

Find the parent function or method declaration for a node (if any)

Implementorsยง