This guide lists the main files you must audit to add a new language to Probe.
Adding a new language requires auditing every language map that affects parsing,
search, extraction, query, CLI validation, docs, and LSP/indexing behavior.
The list below covers the core Probe CLI path; LSP daemon support adds
additional maps under lsp-daemon/src.
Add tree-sitter dependency:
tree-sitter-yourlang = "X.Y.Z"Create language implementation (copy from existing language like rust.rs):
use super::language_trait::LanguageImpl;
use tree_sitter::{Language as TSLanguage, Node};
pub struct YourLangLanguage;
impl LanguageImpl for YourLangLanguage {
fn get_tree_sitter_language(&self) -> TSLanguage {
tree_sitter_yourlang::language().into()
}
// ... implement other required methods
}Add module export:
pub mod yourlang;Add import:
use probe_code::language::yourlang::YourLangLanguage;Add registration:
"yourext" => Some(Box::new(YourLangLanguage::new())),Add to get_language_extensions() function:
"yourlang" => vec![".yourext".to_string()],Add to syntax highlighting mapping:
"yourext" => "yourlang",Add to language mapping:
"yourext" => "yourlang",Add to language mapping and comment prefix:
// In syntax highlighting mapping:
"yourext" => "yourlang",
// In comment prefix mapping (choose appropriate section):
// For # comments:
"py" | "rb" | "sh" | "bash" | "pl" | "r" | "yourext" => "#",
// For // comments:
"rs" | "c" | "h" | "cpp" | "yourext" => "//",Add to language completion lists (2 locations):
"yourlang", "yourext",Add to supported languages description:
'Supported languages: rust, javascript, typescript, python, go, c, cpp, java, ruby, php, swift, solidity, csharp, yourlang.',Add table entry and language-specific features section.
Create comprehensive tests in your language file:
#[cfg(test)]
mod tests {
use super::*;
// Add tests for all LanguageImpl methods
}Copy implementation patterns from similar languages:
get_tree_sitter_language()- Return tree-sitter languageis_acceptable_parent()- Define extractable code blocksis_test_node()- Detect test codeget_symbol_signature()- Extract clean signaturesfind_parent_function()- Optional method
Use tree-sitter playground to understand AST structure: https://tree-sitter.github.io/tree-sitter/playground
After modifying all 11 files:
cargo test- All tests passcargo run -- search "term" file.yourext- Search workscargo run -- extract file.yourext:N- Extract workscargo run -- search "test" --allow-tests- Test detection works