MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / search_in_file

Function search_in_file

crates/opencode-server/src/routes.rs:3083–3096  ·  view source on GitHub ↗
(path: &std::path::Path, pattern: &str, results: &mut Vec<SearchResult>)

Source from the content-addressed store, hash-verified

3081 let mut results = Vec::new();
3082
3083 fn search_in_file(path: &std::path::Path, pattern: &str, results: &mut Vec<SearchResult>) {
3084 if let Ok(content) = std::fs::read_to_string(path) {
3085 for (line_num, line) in content.lines().enumerate() {
3086 if let Some(col) = line.find(pattern) {
3087 results.push(SearchResult {
3088 path: path.to_string_lossy().to_string(),
3089 line: line_num + 1,
3090 column: col + 1,
3091 match_text: line.to_string(),
3092 });
3093 }
3094 }
3095 }
3096 }
3097
3098 fn search_recursive(
3099 path: &FsPath,

Callers 1

search_recursiveFunction · 0.85

Calls 1

findMethod · 0.80

Tested by

no test coverage detected