rust-cargoneovimlanguage-server-protocolrustup

I have problems with lsp server rust-analyzer


When I trying to launch some .rs files (rust files) I catch error in neovim:

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:22: Error executing lua: /usr/share/nvim/runtime/filetype.lua:23: Vim(append):Error
 executing lua callback: Vim:E475: Invalid value for argument cmd: 'cargo' is not executable

My lsp.lua config file is empty, because all servers I installed from Mason, I also reinstall neovim, reinstalled runtime directory etc what was described in internet but nothing changed(((( Small thing about this all, this error was not there until i reinstalled rust to rustup from other rust version (I forgot the name), because I think my autocompletion didn't work because rust version or something else related with my rust blocked this


Solution

  • Well, neovim printed your problem:

    Vim:E475: Invalid value for argument cmd: 'cargo' is not executable
    

    It seemst that you haven't installed cargo which you'll get if you install rust. I'd highly recommend to install rustup with the package manager of your linux-distribution and execute:

    rustup default stable
    

    afterwards. This should install your relevant tools to develop with rust (including your missing program cargo).