@@ -366,34 +366,35 @@ M.defaults.global = vim.tbl_deep_extend("force", M.defaults.files,
366366 line_query = true ,
367367 pickers = function ()
368368 local clients = utils .lsp_get_clients ({ bufnr = FzfLua .core .CTX ().bufnr })
369- return utils .tbl_isempty (clients ) and {
370- { " files" , desc = " Files" },
371- { " buffers" , desc = " Bufs" , prefix = " $" },
372- {
373- " btags" ,
374- desc = " Tags (buf)" ,
375- prefix = " @" ,
376- opts = {
377- fn_transform = [[ return require("fzf-lua.make_entry").tag]] ,
378- }
379- },
380- {
381- " tags" ,
382- desc = " Tags (project)" ,
383- prefix = " #" ,
384- opts = {
385- fn_transform = [[ return require("fzf-lua.make_entry").tag]] ,
386- rg_opts = " --no-heading --color=always --smart-case" ,
387- grep_opts = " --color=auto --perl-regexp" ,
388- }
389- },
369+ local doc_sym_supported = vim .iter (clients ):any (function (client )
370+ return client .supports_method (" textDocument/documentSymbol" )
371+ end )
372+ local wks_sym_supported = vim .iter (clients ):any (function (client )
373+ return client .supports_method (" workspace/symbol" )
374+ end )
375+ return {
376+ { " files" , desc = " Files" },
377+ { " buffers" , desc = " Bufs" , prefix = " $" },
378+ doc_sym_supported and { " lsp_document_symbols" , desc = " Symbols (buf)" , prefix = " @" } or {
379+ " btags" ,
380+ desc = " Tags (buf)" ,
381+ prefix = " @" ,
382+ opts = {
383+ fn_transform = [[ return require("fzf-lua.make_entry").tag]] ,
390384 }
391- or {
392- { " files" , desc = " Files" },
393- { " buffers" , desc = " Bufs" , prefix = " $" },
394- { " lsp_document_symbols" , desc = " Symbols (buf)" , prefix = " @" },
395- { " lsp_workspace_symbols" , desc = " Symbols (project)" , prefix = " #" },
385+ },
386+ wks_sym_supported and { " lsp_workspace_symbols" , desc = " Symbols (project)" , prefix = " #" } or
387+ {
388+ " tags" ,
389+ desc = " Tags (project)" ,
390+ prefix = " #" ,
391+ opts = {
392+ fn_transform = [[ return require("fzf-lua.make_entry").tag]] ,
393+ rg_opts = " --no-heading --color=always --smart-case" ,
394+ grep_opts = " --color=auto --perl-regexp" ,
396395 }
396+ },
397+ }
397398 end ,
398399 fzf_opts = { [" --nth" ] = false , [" --with-nth" ] = false },
399400 winopts = { preview = { winopts = { cursorline = true } } },
0 commit comments