Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rust-analyzer #2832

Closed
nycex opened this issue Oct 13, 2019 · 11 comments · Fixed by #2837
Closed

Support rust-analyzer #2832

nycex opened this issue Oct 13, 2019 · 11 comments · Fixed by #2837
Labels
LSP Any issue relating to LSP or tsserver new tool Support for new linters, fixers, etc.

Comments

@nycex
Copy link

nycex commented Oct 13, 2019

Add support for rust-analyzer

Name: rust-analyzer
URL: https://github.com/rust-analyzer/rust-analyzer

rust-analyzer is an experimental rust language server which is part of a rls 2.0 effort.

@w0rp w0rp added LSP Any issue relating to LSP or tsserver new tool Support for new linters, fixers, etc. labels Oct 14, 2019
@cwndrws
Copy link

cwndrws commented Dec 11, 2019

For anyone else who wants to use rust-analyzer with ale before that PR is merged, this is how I have my ftplugin/rust.vim to do it:

let b:ale_linters = ['rls']
let g:ale_rust_rls_executable = 'rust-analyzer'
let b:ale_fixers = ['rustfmt']

Because they both use the LSP interface, it works as a drop in replacement.

@kamek-pf
Copy link

kamek-pf commented Jan 3, 2020

@cwndrws did you manage to also get clippy working with this setup ?

@cwndrws
Copy link

cwndrws commented Jan 3, 2020

@kamek-pf no, as far as I can tell, you can only use clippy if you use the cargo linter.

@elshize
Copy link

elshize commented Feb 27, 2020

@cwndrws I got it working, but with executable rust-analyzer (maybe it changed in the meantime?)

@cwndrws
Copy link

cwndrws commented Feb 27, 2020

@elshize Yeah it looks like they changed the name of the binary in this commit. I have updated the snippet in my comment.

@ghost
Copy link

ghost commented Mar 7, 2020

Because they both use the LSP interface, it works as a drop in replacement.

Doesn't work for me. Does it work for you now?

@elshize
Copy link

elshize commented Mar 7, 2020

@xliiv yeah, I've been using it for a week or so now. Here's my rust-related ALE config in .vimrc:

let g:ale_rust_rls_config = {
	\ 'rust': {
		\ 'all_targets': 1,
		\ 'build_on_save': 1,
		\ 'clippy_preference': 'on'
	\ }
	\ }
let g:ale_rust_rls_toolchain = ''
let g:ale_rust_rls_executable = 'rust-analyzer'
let g:ale_linters = {
    \ 'rust': ['rls']
    \ }
let g:ale_fixers = {
    \ 'rust': ['rustfmt']
    \ }

If you're not seeing any effects, I suggest running :ALEInfo and seeing what the logs say.

@ghost
Copy link

ghost commented Mar 7, 2020

@elshize thanks it helps, not it's running.

it started working when i put this line

let g:ale_rust_rls_toolchain = ''

previously i had this one

let g:ale_rust_rls_toolchain="stable"

@elshize
Copy link

elshize commented Mar 10, 2020

Does anyone know if it is possible to enable clippy for rust-analyzer? That option 'clippy_preference': 'on' that worked on rls doesn't seem to work anymore, at least I'm not getting any clippy warnings. Any ideas?

Arzte pushed a commit to Arzte/ale that referenced this issue Apr 9, 2020
Fixes dense-analysis#2832

Signed-off-by: Iris Faey Hoffmeyer <hoffmeyer25@gmail.com>
@cuviper
Copy link

cuviper commented Apr 22, 2020

There's now an RFC for Rust to officially transition from RLS to rust-analyzer: rust-lang/rfcs#2912

@sbromberger
Copy link

I can't seem to get rust-analyzer to lint properly on leaving insert mode. It takes about a second for an error to show up in the gutter, and then when I erase the offending line, the error doesn't disappear. It's not quite a replacement for rls because rls doesn't seem to have this problem.

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LSP Any issue relating to LSP or tsserver new tool Support for new linters, fixers, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants