@@ -458,7 +458,6 @@ pub(crate) fn handle_workspace_symbol(
458458
459459 let config = snap. config . workspace_symbol ( ) ;
460460 let ( all_symbols, libs) = decide_search_scope_and_kind ( & params, & config) ;
461- let limit = config. search_limit ;
462461
463462 let query = {
464463 let query: String = params. query . chars ( ) . filter ( |& c| c != '#' && c != '*' ) . collect ( ) ;
@@ -469,14 +468,11 @@ pub(crate) fn handle_workspace_symbol(
469468 if libs {
470469 q. libs ( ) ;
471470 }
472- q. limit ( limit) ;
473471 q
474472 } ;
475- let mut res = exec_query ( & snap, query) ?;
473+ let mut res = exec_query ( & snap, query, config . search_limit ) ?;
476474 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 ) ?;
480476 }
481477
482478 return Ok ( Some ( lsp_types:: WorkspaceSymbolResponse :: Nested ( res) ) ) ;
@@ -519,9 +515,10 @@ pub(crate) fn handle_workspace_symbol(
519515 fn exec_query (
520516 snap : & GlobalStateSnapshot ,
521517 query : Query ,
518+ limit : usize ,
522519 ) -> anyhow:: Result < Vec < lsp_types:: WorkspaceSymbol > > {
523520 let mut res = Vec :: new ( ) ;
524- for nav in snap. analysis . symbol_search ( query) ? {
521+ for nav in snap. analysis . symbol_search ( query, limit ) ? {
525522 let container_name = nav. container_name . as_ref ( ) . map ( |v| v. to_string ( ) ) ;
526523
527524 let info = lsp_types:: WorkspaceSymbol {
0 commit comments