Telescope lsp_lsp_document_symbols, how to show only functions

Hi,

is there a way to list via Telescope (via lsp_document_symbols) only the document functions. By default also the variables are listed. But in some cases I only want to see the functions.

== Feek

As mostly of the time, asking the question will make your own search better… solution:
Telescope lsp_document_symbols ignore_symbols=variable

1 Like

Thanks for sharing this. I’ve also found out you can just do :help lsp_document_symbols to get help for the Lua API of this function which helped me set up my keymappings in init.lua.

For example to get only methods

:Telescope lsp_document_symbols symbols={"method"}

and to get methods or functions

:Telescope lsp_document_symbols symbols={"method", "function"}

and if you want to make a mapping for \lm (list methods) :

keymap.set("n", "<leader>lm", function() 
   require("telescope.builtin").lsp_document_symbols({symbols={"method","function"}}) 
end, opts)
1 Like