Rust VIM autocomplete

I've been using Vim 8 for Rust development with rust.vim and syntastic for syntax highlighting, etc.

I thought I'd check out a more full-featured configuration following the instructions here

Unfortunately I get an error when starting up vim:

Error detected while processing VimEnter Autocommands for "*":
E117: Unknown function: lsp#enable

I am not sure what the problem is. Note that rust-analyzer is preferred over RLS as language server nowadays. It is much faster and has many features that RLS is missing. One of the vim lsp plugins listed in the installation guide is coc.nvim, you could try it instead of vim-lsp. coc.nvim works with vim too, but requires node.js to be installed.

I find the whole thing rather confusing.

rls mentions racer in the setup instructions but it isn't clear if it is actually required. rls needs rust-analysis (which I conflated with rust-analyzer, thinking they were the same thing).

Is rls deprecated in favor of rust-analyzer? rust-analyzer isn't available on stable? Does that impact what toolchain I am using, or only what toolchain is needed to build rust-analyzer? Strike that, I thought it should be added as a component like rust-analysis. Trying to install via cargo produces a message that there is no binary to install for rust-analyzer.

Edit: Ok, I git cloned rust-analyzer and built it. I placed the executable in my path. Installed YouCompleteMe plugin for vim, which according to the rust-analyzer manual, should work out of the box. It doesn't seem to do anything at all. I'm wondering if the version of YouCompleteMe might be older than expected in the manual. It'd be helpful if documentation listed actual required versions of things. :roll_eyes:

Final edit: I gave up. Trying to get a newer YCM plugin led to needing a newer CMake. I've already wasted more time on this than any amount of semantic analysis and autocompletion would ever have saved me. I'm going back to my simple but efficient setup with rust.vim.

I had the same issue with YCM. I switched to using coc instead, and it Just Worked without a hitch. For completeness: I'm using vim and not nvim.

1 Like

Thanks anyway, but I'm not using coc.

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.