@@ -1205,12 +1205,13 @@ MiniExtra.pickers.lsp = function(local_opts, opts)
12051205 }
12061206 local scope = H .pick_validate_scope (local_opts , allowed_scopes , ' lsp' )
12071207
1208- if scope == ' references' then return vim .lsp .buf [scope ](nil , { on_list = H .lsp_make_on_list (scope , opts ) }) end
1208+ local buf_lsp_opts = H .lsp_make_opts (scope , opts )
1209+ if scope == ' references' then return vim .lsp .buf [scope ](nil , buf_lsp_opts ) end
12091210 if scope == ' workspace_symbol' then
12101211 local query = tostring (local_opts .symbol_query )
1211- return vim .lsp .buf [scope ](query , { on_list = H . lsp_make_on_list ( scope , opts ) } )
1212+ return vim .lsp .buf [scope ](query , buf_lsp_opts )
12121213 end
1213- vim .lsp .buf [scope ]({ on_list = H . lsp_make_on_list ( scope , opts ) } )
1214+ vim .lsp .buf [scope ](buf_lsp_opts )
12141215end
12151216
12161217--- Neovim marks picker
@@ -1924,8 +1925,8 @@ H.git_difflines_to_hunkitems = function(lines, n_context)
19241925end
19251926
19261927-- LSP picker -----------------------------------------------------------------
1927- H .lsp_make_on_list = function (source , opts )
1928- local is_symbol = source == ' document_symbol ' or source == ' workspace_symbol '
1928+ H .lsp_make_opts = function (source , opts )
1929+ local is_symbol = source : find ( ' symbol ' ) ~= nil
19291930
19301931 -- Prepend file position info to item, add decortion, and sort
19311932 local add_decor_data = function () end
@@ -1958,41 +1959,42 @@ H.lsp_make_on_list = function(source, opts)
19581959 end
19591960
19601961 local pick = H .validate_pick ()
1962+ local picker_opts = { source = { name = string.format (' LSP (%s)' , source ) } }
1963+
19611964 local show_explicit = H .pick_get_config ().source .show
1962- local show = function (buf_id , items_to_show , query )
1965+ picker_opts . source . show = function (buf_id , items_to_show , query )
19631966 if show_explicit ~= nil then return show_explicit (buf_id , items_to_show , query ) end
1964- if is_symbol then
1965- pick . default_show (buf_id , items_to_show , query )
1967+ -- Show with icons as the non-symbol scopes should have paths
1968+ if not is_symbol then return H . show_with_icons (buf_id , items_to_show , query ) end
19661969
1967- -- Highlight whole lines with pre-computed symbol kind highlight groups
1968- H . pick_clear_namespace (buf_id , H . ns_id . pickers )
1969- for i , item in ipairs ( items_to_show ) do
1970- H . pick_highlight_line (buf_id , i , item . hl , 199 )
1971- end
1972- return
1970+ -- Highlight whole lines with pre-computed symbol kind highlight groups
1971+ pick . default_show (buf_id , items_to_show , query )
1972+
1973+ H . pick_clear_namespace (buf_id , H . ns_id . pickers )
1974+ for i , item in ipairs ( items_to_show ) do
1975+ H . pick_highlight_line ( buf_id , i , item . hl , 199 )
19731976 end
1974- -- Show with icons as the non-symbol scopes should have paths
1975- return H .show_with_icons (buf_id , items_to_show , query )
19761977 end
19771978
1978- local choose = function (item )
1979+ picker_opts . source . choose = function (item )
19791980 pick .default_choose (item )
19801981 -- Ensure relative path in `:buffers` output with hacky workaround.
19811982 -- `default_choose` ensures it with `bufadd(fnamemodify(path, ':.'))`, but
19821983 -- somehow that doesn't work inside `on_list` of `vim.lsp.buf` methods.
19831984 vim .fn .chdir (vim .fn .getcwd ())
19841985 end
19851986
1986- return function (data )
1987+ local on_list = function (data )
19871988 local items = data .items
19881989 for _ , item in ipairs (data .items ) do
19891990 item .text , item .path = item .text or ' ' , item .filename or nil
19901991 end
19911992 items = process (items )
19921993
1993- local source_opts = { name = string.format (' LSP (%s)' , source ), show = show , choose = choose }
1994- return H .pick_start (items , { source = source_opts }, opts )
1994+ return H .pick_start (items , picker_opts , opts )
19951995 end
1996+
1997+ return { on_list = on_list }
19961998end
19971999
19982000H .get_symbol_kind_map = function ()
0 commit comments