probe_code/language/
language_trait.rs

1use tree_sitter::{Language as TSLanguage, Node};
2
3/// Trait that defines the interface for all language implementations.
4pub trait LanguageImpl {
5    /// Get the tree-sitter language for parsing
6    fn get_tree_sitter_language(&self) -> TSLanguage;
7
8    /// Check if a node is an acceptable container/parent entity
9    fn is_acceptable_parent(&self, node: &Node) -> bool;
10
11    /// Check if a node represents a test
12    fn is_test_node(&self, node: &Node, source: &[u8]) -> bool;
13
14    /// Get the file extension for this language
15    #[deprecated(since = "0.1.0", note = "this method is not used")]
16    #[allow(dead_code)]
17    fn get_extension(&self) -> &'static str;
18
19    /// Find the parent function or method declaration for a node (if any)
20    fn find_parent_function<'a>(&self, _node: Node<'a>) -> Option<Node<'a>> {
21        // Default implementation returns None
22        None
23    }
24}