@@ -458,7 +458,6 @@ pub(crate) fn handle_workspace_symbol(
458
458
459
459
let config = snap. config . workspace_symbol ( ) ;
460
460
let ( all_symbols, libs) = decide_search_scope_and_kind ( & params, & config) ;
461
- let limit = config. search_limit ;
462
461
463
462
let query = {
464
463
let query: String = params. query . chars ( ) . filter ( |& c| c != '#' && c != '*' ) . collect ( ) ;
@@ -469,14 +468,11 @@ pub(crate) fn handle_workspace_symbol(
469
468
if libs {
470
469
q. libs ( ) ;
471
470
}
472
- q. limit ( limit) ;
473
471
q
474
472
} ;
475
- let mut res = exec_query ( & snap, query) ?;
473
+ let mut res = exec_query ( & snap, query, config . search_limit ) ?;
476
474
if res. is_empty ( ) && !all_symbols {
477
- let mut query = Query :: new ( params. query ) ;
478
- query. limit ( limit) ;
479
- res = exec_query ( & snap, query) ?;
475
+ res = exec_query ( & snap, Query :: new ( params. query ) , config. search_limit ) ?;
480
476
}
481
477
482
478
return Ok ( Some ( lsp_types:: WorkspaceSymbolResponse :: Nested ( res) ) ) ;
@@ -519,9 +515,10 @@ pub(crate) fn handle_workspace_symbol(
519
515
fn exec_query (
520
516
snap : & GlobalStateSnapshot ,
521
517
query : Query ,
518
+ limit : usize ,
522
519
) -> anyhow:: Result < Vec < lsp_types:: WorkspaceSymbol > > {
523
520
let mut res = Vec :: new ( ) ;
524
- for nav in snap. analysis . symbol_search ( query) ? {
521
+ for nav in snap. analysis . symbol_search ( query, limit ) ? {
525
522
let container_name = nav. container_name . as_ref ( ) . map ( |v| v. to_string ( ) ) ;
526
523
527
524
let info = lsp_types:: WorkspaceSymbol {
0 commit comments