Is it possible to do search property/function etc. by usages? For example I select some property, search it by usages and it displays me all usages for current project in telescope. I want to reach same thing like JetBrains IDE’s do.
1 Like
Might this work?:
vim.lsp.buf.references()
Sure, to view it in telescope
, with some nice fuzzy finding, use this:
require('telescope.builtin').lsp_references()
Find out more with: :help telescope.builtin
Of course solution suggested by @altermo also works but it will display results in quicklist window so it doesn’t need telescope
. Both solutions need LSP to be set up.
Without LSP you can press #
and *
to search and jump between occurrences of word under cursor, which might be a convenient way to jump between function call and declaration in the current file or for many other scenarios.
For anyone looking for a quick telescope config, here is the one that worked for me:
vim.keymap.set('n', '<leader>fu', ':lua require("telescope.builtin").lsp_references()<CR>', { noremap = true, silent = true })