Add Racket tree-sitter support, remove Kotlin

- Add tree-sitter-racket dependency (v0.24)
- Initialize Racket parser in code search
- Add .rkt, .rktl, .rktd file extensions
- Add test_racket_search test
- Remove Kotlin from supported languages (was disabled)
- Clean up duplicate test files

Supported languages: Rust, Python, JavaScript, TypeScript, Go, Java, C, C++, Racket
This commit is contained in:
Dhanji R. Prasanna
2026-01-13 18:44:59 +05:30
parent 5e45e110e2
commit 151b8c4658
7 changed files with 42 additions and 46 deletions

View File

@@ -121,17 +121,6 @@ impl TreeSitterSearcher {
languages.insert("cpp".to_string(), language);
}
// // Initialize Kotlin - Temporarily disabled due to tree-sitter version incompatibility
// {
// let mut parser = Parser::new();
// let language: Language = tree_sitter_kotlin::language();
// parser
// .set_language(&language)
// .map_err(|e| anyhow!("Failed to set Kotlin language: {}", e))?;
// parsers.insert("kotlin".to_string(), parser);
// languages.insert("kotlin".to_string(), language);
// }
// Initialize Haskell
{
let mut parser = Parser::new();
@@ -154,6 +143,17 @@ impl TreeSitterSearcher {
languages.insert("scheme".to_string(), language);
}
// Initialize Racket
{
let mut parser = Parser::new();
let language: Language = tree_sitter_racket::LANGUAGE.into();
parser
.set_language(&language)
.map_err(|e| anyhow!("Failed to set Racket language: {}", e))?;
parsers.insert("racket".to_string(), parser);
languages.insert("racket".to_string(), language);
}
if parsers.is_empty() {
return Err(anyhow!(
"No language parsers available. Enable at least one language feature."
@@ -335,9 +335,10 @@ impl TreeSitterSearcher {
("java", Some("java")) => true,
("c", Some("c" | "h")) => true,
("cpp", Some("cpp" | "cc" | "cxx" | "hpp" | "hxx" | "h")) => true,
("kotlin", Some("kt" | "kts")) => true,
("haskell", Some("hs" | "lhs")) => true,
("scheme", Some("scm" | "ss" | "sld" | "sls")) => true,
("racket", Some("rkt" | "rktl" | "rktd")) => true,
_ => false,
}
}

View File

@@ -227,7 +227,7 @@ fn create_core_tools(exclude_research: bool) -> Vec<Tool> {
},
Tool {
name: "code_search".to_string(),
description: "Syntax-aware code search that understands code structure, not just text. Finds actual functions, classes, methods, and other code constructs - ignores matches in comments and strings. Much more accurate than grep for code searches. Supports batch searches (up to 20 parallel) with structured results and context lines. Languages: Rust, Python, JavaScript, TypeScript, Go, Java, C, C++, Kotlin. Uses tree-sitter query syntax.".to_string(),
description: "Syntax-aware code search that understands code structure, not just text. Finds actual functions, classes, methods, and other code constructs - ignores matches in comments and strings. Much more accurate than grep for code searches. Supports batch searches (up to 20 parallel) with structured results and context lines. Languages: Rust, Python, JavaScript, TypeScript, Go, Java, C, C++, Racket. Uses tree-sitter query syntax.".to_string(),
input_schema: json!({
"type": "object",
"properties": {
@@ -239,7 +239,7 @@ fn create_core_tools(exclude_research: bool) -> Vec<Tool> {
"properties": {
"name": { "type": "string", "description": "Label for this search." },
"query": { "type": "string", "description": "tree-sitter query in S-expression format (e.g., \"(function_item name: (identifier) @name)\")" },
"language": { "type": "string", "enum": ["rust", "python", "javascript", "typescript", "go", "java", "c", "cpp", "kotlin"], "description": "Programming language to search." },
"language": { "type": "string", "enum": ["rust", "python", "javascript", "typescript", "go", "java", "c", "cpp", "racket"], "description": "Programming language to search." },
"paths": { "type": "array", "items": { "type": "string" }, "description": "Paths/dirs to search. Defaults to current dir if empty." },
"context_lines": { "type": "integer", "minimum": 0, "maximum": 20, "default": 0, "description": "Lines of context to include around each match." }
},