@@ -489,16 +489,25 @@ function fd:new(args)
489489 self .inexist = config .finder .sp_inexist
490490 end
491491 self .layout = layout or config .finder .layout
492+
493+ local curbuf = api .nvim_get_current_buf ()
494+ local params = lsp .util .make_position_params (0 , util .get_offset_encoding ({ bufnr = curbuf }))
495+ params .context = {
496+ includeDeclaration = true ,
497+ }
498+ if type (config .finder .references_opts ) == ' boolean' then
499+ params .context = {
500+ includeDeclaration = config .finder .references_opts ,
501+ }
502+ end
503+
492504 if # meth == 0 then
493505 meth = vim .split (config .finder .default , ' +' , { plain = true })
494506 end
495507 local methods = box .get_methods (meth )
496-
497508 methods = vim .tbl_filter (function (method )
498509 return # util .get_client_by_method (method ) > 0
499510 end , methods )
500- local curbuf = api .nvim_get_current_buf ()
501- self .ft = vim .bo [curbuf ].filetype
502511 if # methods == 0 then
503512 vim .notify (
504513 (' [lspsaga] no servers of buffer %s makes these methods available %s' ):format (
@@ -510,23 +519,24 @@ function fd:new(args)
510519 return
511520 end
512521
522+ local methods_with_params = vim .tbl_map (function (method )
523+ return util .gen_param_by_config (method , params , config .finder .references_opts )
524+ end , methods )
525+
526+ self .ft = vim .bo [curbuf ].filetype
513527 self .list = slist .new ()
514- local params = lsp .util .make_position_params (0 , util .get_offset_encoding ({ bufnr = curbuf }))
515- params .context = {
516- includeDeclaration = true ,
517- }
518528
519529 local spin_close = box .spinner ()
520530 local count = 0
521531 coroutine.resume (coroutine.create (function ()
522532 local retval = {}
523533 local co = coroutine.running ()
524- for _ , method in ipairs (methods ) do
525- lsp .buf_request_all (curbuf , method , params , function (results )
534+ for _ , item in ipairs (methods_with_params ) do
535+ lsp .buf_request_all (curbuf , item [ 1 ], item [ 2 ] , function (results )
526536 count = count + 1
527- results = box .filter (method , results )
537+ results = box .filter (item [ 1 ] , results )
528538 if results and not util .res_isempty (results ) then
529- retval [method ] = results
539+ retval [item [ 1 ] ] = results
530540 end
531541 if count == # methods then
532542 coroutine.resume (co )
0 commit comments