Smartest Rust Autocomplete?

55 points Me163k

I just tried RustRover for the first time and its autocomplete seems to be more context aware than any other editor that I've used to write Rust.

For example, I have a function that returns a type Result<T, E>. In the function body I have a variable a that is of type Option<T>. If I type a. on the last line of the function, RustRover will suggest (at the very top of the autocomplete suggestion list) the ok_or function to convert the Option to a Result prior to returning the value - which is probably the best suggestion 99% of the time.

Given the same situation, all other editors that I've written Rust in - primarily Emacs (DOOM) and Neovim (Lazyvim) - will put mostly irrelevant things at the top of the suggestion list. They do not really seem to incorporate the context (type of the receiver) into their suggestions, at least with my configuration.

Here's my DOOM emacs config: https://github.com/MoonKraken/dotfiles/tree/master/.doom.d

And my LazyVim config:
https://github.com/MoonKraken/lazyvim-config

I vastly prefer CLI editors and I'd love to replicate the intelligence of the JetBrains autocomplete into one of them somehow.

Are you happy with your Rust autocomplete? If so what is your setup?