@@ -67,7 +67,8 @@ impl FileType {
6767 fn from_path ( path : & std:: path:: Path ) -> Self {
6868 if let Some ( ext) = path. extension ( ) . and_then ( |e| e. to_str ( ) ) {
6969 match ext {
70- "rs" | "py" | "ts" | "tsx" | "js" | "jsx" | "go" | "java" | "c" | "cpp" | "h" | "hpp" => Self :: Code ,
70+ "rs" | "py" | "ts" | "tsx" | "js" | "jsx" | "go" | "java" | "c" | "cpp" | "h"
71+ | "hpp" => Self :: Code ,
7172 "toml" | "yaml" | "yml" | "json" | "ini" | "conf" => Self :: Config ,
7273 "md" | "txt" | "rst" | "adoc" => Self :: Documentation ,
7374 _ => Self :: Other ,
@@ -216,7 +217,14 @@ impl AgenticSearchTool {
216217
217218 // Phase 1+2: Parallel search across all keywords
218219 let matches = tokio:: task:: spawn_blocking ( move || {
219- search_workspace ( & workspace, & keywords, max_results, include. as_deref ( ) , context_lines, registry. as_deref ( ) )
220+ search_workspace (
221+ & workspace,
222+ & keywords,
223+ max_results,
224+ include. as_deref ( ) ,
225+ context_lines,
226+ registry. as_deref ( ) ,
227+ )
220228 } )
221229 . await
222230 . map_err ( |e| anyhow:: anyhow!( "Search task failed: {}" , e) ) ??;
@@ -257,7 +265,14 @@ impl AgenticSearchTool {
257265
258266 // Phase 1: Initial broad search (2x max_results for sampling pool)
259267 let initial_matches = tokio:: task:: spawn_blocking ( move || {
260- search_workspace ( & workspace, & keywords, max_results * 2 , include. as_deref ( ) , context_lines, registry. as_deref ( ) )
268+ search_workspace (
269+ & workspace,
270+ & keywords,
271+ max_results * 2 ,
272+ include. as_deref ( ) ,
273+ context_lines,
274+ registry. as_deref ( ) ,
275+ )
261276 } )
262277 . await
263278 . map_err ( |e| anyhow:: anyhow!( "Search task failed: {}" , e) ) ??;
@@ -331,14 +346,13 @@ impl AgenticSearchTool {
331346/// - Individual words (for broad match)
332347fn extract_keywords ( query : & str ) -> Vec < String > {
333348 const STOP_WORDS : & [ & str ] = & [
334- "a" , "an" , "the" , "is" , "are" , "was" , "were" , "be" , "been" , "being" ,
335- "have" , "has" , "had" , "do" , "does" , "did" , "will" , "would" , "could" ,
336- "should" , "may" , "might" , "shall" , "can" , "need" , "dare" , "ought" ,
337- "how" , "what" , "where" , "when" , "why" , "who" , "which" , "that" , "this" ,
338- "these" , "those" , "it" , "its" , "in" , "on" , "at" , "to" , "for" , "of" ,
339- "with" , "by" , "from" , "up" , "about" , "into" , "through" , "during" ,
340- "and" , "or" , "but" , "not" , "no" , "nor" , "so" , "yet" , "both" , "either" ,
341- "work" , "works" , "working" , "find" , "get" , "use" , "make" , "look" ,
349+ "a" , "an" , "the" , "is" , "are" , "was" , "were" , "be" , "been" , "being" , "have" , "has" , "had" ,
350+ "do" , "does" , "did" , "will" , "would" , "could" , "should" , "may" , "might" , "shall" , "can" ,
351+ "need" , "dare" , "ought" , "how" , "what" , "where" , "when" , "why" , "who" , "which" , "that" ,
352+ "this" , "these" , "those" , "it" , "its" , "in" , "on" , "at" , "to" , "for" , "of" , "with" , "by" ,
353+ "from" , "up" , "about" , "into" , "through" , "during" , "and" , "or" , "but" , "not" , "no" , "nor" ,
354+ "so" , "yet" , "both" , "either" , "work" , "works" , "working" , "find" , "get" , "use" , "make" ,
355+ "look" ,
342356 ] ;
343357
344358 let mut keywords: Vec < String > = Vec :: new ( ) ;
@@ -397,9 +411,7 @@ fn search_workspace(
397411 // Build regex patterns for each keyword
398412 let patterns: Vec < Regex > = keywords
399413 . iter ( )
400- . filter_map ( |kw| {
401- Regex :: new ( & format ! ( "(?i){}" , regex:: escape( kw) ) ) . ok ( )
402- } )
414+ . filter_map ( |kw| Regex :: new ( & format ! ( "(?i){}" , regex:: escape( kw) ) ) . ok ( ) )
403415 . collect ( ) ;
404416
405417 if patterns. is_empty ( ) {
@@ -581,11 +593,7 @@ fn find_matching_files(
581593// ============================================================================
582594
583595fn format_results ( matches : & [ FileMatch ] , query : & str ) -> String {
584- let mut out = format ! (
585- "Found {} file(s) matching \" {}\" \n \n " ,
586- matches. len( ) ,
587- query
588- ) ;
596+ let mut out = format ! ( "Found {} file(s) matching \" {}\" \n \n " , matches. len( ) , query) ;
589597
590598 for ( i, fm) in matches. iter ( ) . enumerate ( ) {
591599 let rel_path = fm. path . display ( ) ;
@@ -598,9 +606,7 @@ fn format_results(matches: &[FileMatch], query: &str) -> String {
598606
599607 out. push_str ( & format ! (
600608 "─── {} ({}, relevance: {:.2}) ───\n " ,
601- rel_path,
602- type_label,
603- fm. relevance
609+ rel_path, type_label, fm. relevance
604610 ) ) ;
605611
606612 for m in fm. matches . iter ( ) . take ( 5 ) {
@@ -825,7 +831,11 @@ mod tests {
825831 writeln ! ( f, "pub struct Session {{\n pub user_id: String,\n pub token: String,\n }}\n \n impl Session {{\n pub fn new(user_id: &str, token: &str) -> Self {{\n Self {{ user_id: user_id.to_string(), token: token.to_string() }}\n }}\n }}" ) . unwrap ( ) ;
826832
827833 let mut f = File :: create ( root. join ( "README.md" ) ) . unwrap ( ) ;
828- writeln ! ( f, "# Auth Service\n \n Handles JWT authentication and session management." ) . unwrap ( ) ;
834+ writeln ! (
835+ f,
836+ "# Auth Service\n \n Handles JWT authentication and session management."
837+ )
838+ . unwrap ( ) ;
829839
830840 dir
831841 }
@@ -855,9 +865,18 @@ mod tests {
855865
856866 #[ test]
857867 fn test_file_type_detection ( ) {
858- assert_eq ! ( FileType :: from_path( std:: path:: Path :: new( "main.rs" ) ) , FileType :: Code ) ;
859- assert_eq ! ( FileType :: from_path( std:: path:: Path :: new( "config.toml" ) ) , FileType :: Config ) ;
860- assert_eq ! ( FileType :: from_path( std:: path:: Path :: new( "README.md" ) ) , FileType :: Documentation ) ;
868+ assert_eq ! (
869+ FileType :: from_path( std:: path:: Path :: new( "main.rs" ) ) ,
870+ FileType :: Code
871+ ) ;
872+ assert_eq ! (
873+ FileType :: from_path( std:: path:: Path :: new( "config.toml" ) ) ,
874+ FileType :: Config
875+ ) ;
876+ assert_eq ! (
877+ FileType :: from_path( std:: path:: Path :: new( "README.md" ) ) ,
878+ FileType :: Documentation
879+ ) ;
861880 }
862881
863882 #[ tokio:: test]
@@ -916,7 +935,10 @@ mod tests {
916935
917936 assert ! ( output. success) ;
918937 if let Some ( meta) = & output. metadata {
919- let count = meta. get ( "result_count" ) . and_then ( |v| v. as_u64 ( ) ) . unwrap_or ( 0 ) ;
938+ let count = meta
939+ . get ( "result_count" )
940+ . and_then ( |v| v. as_u64 ( ) )
941+ . unwrap_or ( 0 ) ;
920942 assert ! ( count <= 1 ) ;
921943 }
922944 }
0 commit comments