Neovim - rust symbols in file?

I'm trying out neovim with rust-analyzer and a few other plugins. Is there an equivalent of VSCode's 'navigate symbols in file' (ctrl-shift-o) that works for Rust? I don't think vscode depends on lsp for this, so perhaps in neovim it would require ctags?

My main use for this is to jump to functions/methods, so any other method of quickly getting a list of those for a given file or module would work just as well for present purposes.

Looks like the symbols-outline plugin does what you want. It uses lsp to get the symbol list.

You could also check out the telescope plugin - it's got a buitlin-tags function that uses ctags (vim-pickers section).

1 Like

Cheers - hadn't thought of telescope, which I have installed but was only using as a project file picker. Having had a quick look I see it also has some lsp pickers built in (document & workspace symbols), which seem like a good bet as I already like its UI. I shall explore further, thanks.

1 Like

In AstroNvim, they use telescope and in particular the built-in picker lsp_document_symbols. It works great! They also augment it with aerial.

Yep, just key-mapped lsp_document_symbols which is perfect (even has a nice symbol--type filter).

Thanks for the aerial pointer -- I've added it to my list of plugins to check out (there are almost too many).

aerial is also a choice, which is in active development compared to symbols-outline.
I used litee-symboltree for a while, and it's a little complicated/verbose to use. Now I use symbols-outline.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.