Shortcut to automatically apply rust-analyzer suggestions in (N)Vim


rust-analyzer gives me a suggestion to refactor this code.
What is the keyboard shortcut for applying suggestions?
If I need to manually bind some shortcut key to do that, how can I do that?

If you're using coc.nvim, here's the suggestion from the README for binding a shortcut to the quickfix command:

" Apply AutoFix to problem on the current line.
nmap <leader>qf  <Plug>(coc-fix-current)

If you're using LanguageClient-neovim, I think the equialent is the <Plug>(lcn-code-action) mapping.

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.