@@ -271,7 +271,10 @@ pub fn SearchBar(
271271 item
272272 } )
273273 . collect ( ) ;
274- groups. push ( SuggestionGroup { title : "Paths" , items } ) ;
274+ groups. push ( SuggestionGroup {
275+ title : "Paths" ,
276+ items,
277+ } ) ;
275278 }
276279 AutocompleteMode :: DslKey => {
277280 let items = dsl_suggestions
@@ -288,7 +291,10 @@ pub fn SearchBar(
288291 item
289292 } )
290293 . collect ( ) ;
291- groups. push ( SuggestionGroup { title : "DSL" , items } ) ;
294+ groups. push ( SuggestionGroup {
295+ title : "DSL" ,
296+ items,
297+ } ) ;
292298 }
293299 AutocompleteMode :: Symbol => {
294300 let symbol_items = results
@@ -364,7 +370,10 @@ pub fn SearchBar(
364370 item
365371 } )
366372 . collect ( ) ;
367- groups. push ( SuggestionGroup { title : "Branches" , items } ) ;
373+ groups. push ( SuggestionGroup {
374+ title : "Branches" ,
375+ items,
376+ } ) ;
368377 }
369378 AutocompleteMode :: FileValue => {
370379 let items = results
@@ -381,7 +390,10 @@ pub fn SearchBar(
381390 item
382391 } )
383392 . collect ( ) ;
384- groups. push ( SuggestionGroup { title : "Files" , items } ) ;
393+ groups. push ( SuggestionGroup {
394+ title : "Files" ,
395+ items,
396+ } ) ;
385397 }
386398 AutocompleteMode :: CaseValue => {
387399 let term = state. term . to_ascii_lowercase ( ) ;
@@ -400,7 +412,10 @@ pub fn SearchBar(
400412 item
401413 } )
402414 . collect ( ) ;
403- groups. push ( SuggestionGroup { title : "Case" , items } ) ;
415+ groups. push ( SuggestionGroup {
416+ title : "Case" ,
417+ items,
418+ } ) ;
404419 }
405420 AutocompleteMode :: HistoricalValue => {
406421 let term = state. term . to_ascii_lowercase ( ) ;
@@ -491,11 +506,7 @@ pub fn SearchBar(
491506 if !suggestions. is_empty( ) {
492507 let next = match active_index. get( ) {
493508 Some ( idx) => {
494- if idx == 0 {
495- suggestions. len( ) - 1
496- } else {
497- idx - 1
498- }
509+ if idx == 0 { suggestions. len( ) - 1 } else { idx - 1 }
499510 }
500511 None => suggestions. len( ) - 1 ,
501512 } ;
@@ -669,7 +680,6 @@ pub fn SearchBar(
669680 let active_start = autocomplete_state. get( ) . active_start;
670681 let current_query = query. get( ) ;
671682 let set_query = set_query. clone( ) ;
672-
673683 let mut dsl_group = None ;
674684 let mut symbol_group = None ;
675685 let mut other_groups = Vec :: new( ) ;
@@ -680,32 +690,35 @@ pub fn SearchBar(
680690 _ => other_groups. push( group) ,
681691 }
682692 }
693+ let symbol_column = symbol_group
694+ . map( |group| {
695+ render_group_view(
696+ group,
697+ active_idx,
698+ active_start,
699+ current_query. clone( ) ,
700+ set_query,
701+ )
702+ } ) ;
703+ let dsl_column = dsl_group
704+ . map( |group| {
705+ render_group_view(
706+ group,
707+ active_idx,
708+ active_start,
709+ current_query. clone( ) ,
710+ set_query,
711+ )
712+ } ) ;
713+ let two_column = if symbol_column. is_some( ) || dsl_column. is_some( ) {
714+ Some (
683715
684- let symbol_column = symbol_group. map( |group| {
685- render_group_view(
686- group,
687- active_idx,
688- active_start,
689- current_query. clone( ) ,
690- set_query,
691- )
692- } ) ;
693- let dsl_column = dsl_group. map( |group| {
694- render_group_view(
695- group,
696- active_idx,
697- active_start,
698- current_query. clone( ) ,
699- set_query,
716+ view! {
717+ <div class="grid grid-cols-1 md:grid-cols-2 gap-3" >
718+ { symbol_column} { dsl_column}
719+ </div>
720+ } ,
700721 )
701- } ) ;
702- let two_column = if symbol_column. is_some( ) || dsl_column. is_some( ) {
703- Some ( view! {
704- <div class="grid grid-cols-1 md:grid-cols-2 gap-3" >
705- { symbol_column}
706- { dsl_column}
707- </div>
708- } )
709722 } else {
710723 None
711724 } ;
@@ -806,11 +819,9 @@ fn render_group_view(
806819 let items = group. items ;
807820 let empty_label = format ! ( "No {} matches." , group_title. to_lowercase( ) ) ;
808821 let items_view = if items. is_empty ( ) {
809- Either :: Left ( view ! {
810- <div class="text-xs text-gray-500 dark:text-gray-400" >
811- { empty_label}
812- </div>
813- } )
822+ Either :: Left (
823+ view ! { <div class="text-xs text-gray-500 dark:text-gray-400" >{ empty_label} </div> } ,
824+ )
814825 } else {
815826 let current_query = current_query. clone ( ) ;
816827 let rendered = items
@@ -844,13 +855,14 @@ fn render_group_view(
844855 <span class="font-mono text-sm text-gray-900 dark:text-gray-100" >
845856 { label}
846857 </span>
847- { subtitle. map( |text| {
848- view! {
849- <div class="text-xs text-gray-500 dark:text-gray-400 truncate" >
850- { text}
851- </div>
852- }
853- } ) }
858+ { subtitle
859+ . map( |text| {
860+ view! {
861+ <div class="text-xs text-gray-500 dark:text-gray-400 truncate" >
862+ { text}
863+ </div>
864+ }
865+ } ) }
854866 </div>
855867 </div>
856868 }
0 commit comments