How do I get rust-analyzer folds to work in nvim?


In vscode, rust-analyzer can fold multi-line comments / doc-strings / where clauses / mod and use statements / .. etc. But, at the same time VSCodeVim fold commands are so buggy (and there is no plan to solve it anytime soon 1 faq in vscodevim, 2 issue in vscode itself).

So, I was wondering how to enable that in nvim? I've tried both Coc.nvim+coc-rust-analyzer and native lsp in nvim 0.5 and I couldn't find a way to make folds work, It only folds fn / struct / impl code blocks.

I'd appreciate any help :slight_smile:

vim itself has the function of folding code. You can fold any code or comments mannually . If that's not enough for you. Maybe you can try a fold pulgin for vim.

I thought rust-analyzer provides these fold ranges and coc-rust-analyzer would apply them.

I will look into a plugin then, thank you.