@@ -567,7 +567,7 @@ pub(crate) fn handle_document_symbol(
567
567
let file_id = try_default ! ( from_proto:: file_id( & snap, & params. text_document. uri) ?) ;
568
568
let line_index = snap. file_line_index ( file_id) ?;
569
569
570
- let mut parents : Vec < ( lsp_types:: DocumentSymbol , Option < usize > ) > = Vec :: new ( ) ;
570
+ let mut symbols : Vec < ( lsp_types:: DocumentSymbol , Option < usize > ) > = Vec :: new ( ) ;
571
571
572
572
let config = snap. config . document_symbol ( None ) ;
573
573
@@ -576,38 +576,38 @@ pub(crate) fn handle_document_symbol(
576
576
file_id,
577
577
) ?;
578
578
579
- for symbol in structure_nodes {
579
+ for node in structure_nodes {
580
580
let mut tags = Vec :: new ( ) ;
581
- if symbol . deprecated {
581
+ if node . deprecated {
582
582
tags. push ( SymbolTag :: DEPRECATED )
583
583
} ;
584
584
585
585
#[ allow( deprecated) ]
586
- let doc_symbol = lsp_types:: DocumentSymbol {
587
- name : symbol . label ,
588
- detail : symbol . detail ,
589
- kind : to_proto:: structure_node_kind ( symbol . kind ) ,
586
+ let symbol = lsp_types:: DocumentSymbol {
587
+ name : node . label ,
588
+ detail : node . detail ,
589
+ kind : to_proto:: structure_node_kind ( node . kind ) ,
590
590
tags : Some ( tags) ,
591
- deprecated : Some ( symbol . deprecated ) ,
592
- range : to_proto:: range ( & line_index, symbol . node_range ) ,
593
- selection_range : to_proto:: range ( & line_index, symbol . navigation_range ) ,
591
+ deprecated : Some ( node . deprecated ) ,
592
+ range : to_proto:: range ( & line_index, node . node_range ) ,
593
+ selection_range : to_proto:: range ( & line_index, node . navigation_range ) ,
594
594
children : None ,
595
595
} ;
596
- parents . push ( ( doc_symbol , symbol . parent ) ) ;
596
+ symbols . push ( ( symbol , node . parent ) ) ;
597
597
}
598
598
599
- // Builds hierarchy from a flat list, in reverse order (so that indices make sense)
599
+ // Builds hierarchy from a flat list, in reverse order (so that the indices make sense)
600
600
let document_symbols = {
601
601
let mut acc = Vec :: new ( ) ;
602
- while let Some ( ( mut node , parent_idx) ) = parents . pop ( ) {
603
- if let Some ( children) = & mut node . children {
602
+ while let Some ( ( mut symbol , parent_idx) ) = symbols . pop ( ) {
603
+ if let Some ( children) = & mut symbol . children {
604
604
children. reverse ( ) ;
605
605
}
606
606
let parent = match parent_idx {
607
607
None => & mut acc,
608
- Some ( i) => parents [ i] . 0 . children . get_or_insert_with ( Vec :: new) ,
608
+ Some ( i) => symbols [ i] . 0 . children . get_or_insert_with ( Vec :: new) ,
609
609
} ;
610
- parent. push ( node ) ;
610
+ parent. push ( symbol ) ;
611
611
}
612
612
acc. reverse ( ) ;
613
613
acc
@@ -617,7 +617,7 @@ pub(crate) fn handle_document_symbol(
617
617
document_symbols. into ( )
618
618
} else {
619
619
let url = to_proto:: url ( & snap, file_id) ;
620
- let mut symbol_information = Vec :: < SymbolInformation > :: new ( ) ;
620
+ let mut symbol_information = Vec :: new ( ) ;
621
621
for symbol in document_symbols {
622
622
flatten_document_symbol ( & symbol, None , & url, & mut symbol_information) ;
623
623
}
@@ -654,7 +654,7 @@ pub(crate) fn handle_workspace_symbol(
654
654
let _p = tracing:: info_span!( "handle_workspace_symbol" ) . entered ( ) ;
655
655
656
656
let config = snap. config . workspace_symbol ( None ) ;
657
- let ( all_symbols, libs) = decide_search_scope_and_kind ( & params, & config) ;
657
+ let ( all_symbols, libs) = decide_search_kind_and_scope ( & params, & config) ;
658
658
659
659
let query = {
660
660
let query: String = params. query . chars ( ) . filter ( |& c| c != '#' && c != '*' ) . collect ( ) ;
@@ -677,7 +677,7 @@ pub(crate) fn handle_workspace_symbol(
677
677
678
678
return Ok ( Some ( lsp_types:: WorkspaceSymbolResponse :: Nested ( res) ) ) ;
679
679
680
- fn decide_search_scope_and_kind (
680
+ fn decide_search_kind_and_scope (
681
681
params : & WorkspaceSymbolParams ,
682
682
config : & WorkspaceSymbolConfig ,
683
683
) -> ( bool , bool ) {
0 commit comments