added scheme and kotlin to code_search
This commit is contained in:
@@ -118,6 +118,17 @@ impl TreeSitterSearcher {
|
||||
languages.insert("cpp".to_string(), language);
|
||||
}
|
||||
|
||||
// Initialize Kotlin
|
||||
{
|
||||
let mut parser = Parser::new();
|
||||
let language: Language = tree_sitter_kotlin::language().into();
|
||||
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);
|
||||
}
|
||||
|
||||
if parsers.is_empty() {
|
||||
return Err(anyhow!(
|
||||
"No language parsers available. Enable at least one language feature."
|
||||
@@ -299,6 +310,7 @@ 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,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1908,7 +1908,7 @@ Template:
|
||||
// Add code_search tool
|
||||
tools.push(Tool {
|
||||
name: "code_search".to_string(),
|
||||
description: "Batch syntax-aware code searches using embedded tree-sitter. Supports up to 20 searches in parallel for Rust, Python, JavaScript, TypeScript, Go, Java, C, and C++. Uses tree-sitter query syntax (S-expressions).".to_string(),
|
||||
description: "Batch syntax-aware code searches using embedded tree-sitter. Supports up to 20 searches in parallel for Rust, Python, JavaScript, TypeScript, Go, Java, C, C++, and Kotlin. Uses tree-sitter query syntax (S-expressions).".to_string(),
|
||||
input_schema: json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1920,7 +1920,7 @@ Template:
|
||||
"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"], "description": "Programming language to search." },
|
||||
"language": { "type": "string", "enum": ["rust", "python", "javascript", "typescript", "go", "java", "c", "cpp", "kotlin"], "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." }
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user