Skip to content
Chris J-D edited this page Nov 11, 2022 · 9 revisions

rust-analyzer replaces RLS, which is now deprecated.

Installing server

rustup update
rustup component add rust-analyzer

Registering in .vimrc

This code requires neovim v0.2.0+; in earlier versions, it will cause a syntax error.

if executable('rustup')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'rust-analyzer',
        \ 'cmd': {server_info->['rustup', 'run', 'stable', 'rust-analyzer']},
        \ 'allowlist': ['rust'],
        \ })
endif

Installing server

rustup update
rustup component add rls rust-analysis rust-src

Follow instructions at https://github.com/rust-lang/rls#setup in order to install and setup rust language server.

Registering in .vimrc

This code requires neovim v0.2.0+; in earlier versions, it will cause a syntax error.

if executable('rls')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'rls',
        \ 'cmd': {server_info->['rustup', 'run', 'stable', 'rls']},
        \ 'workspace_config': {'rust': {'clippy_preference': 'on'}},
        \ 'whitelist': ['rust'],
        \ })
endif