-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Allow selecting targets instead of passing --all-targets #2142
Comments
You can work around this issue using the following {
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.extraArgs": [
"--bins"
]
} (that calls You can use other combinations like Omit Note that It would be nice if RA used the right |
By |
I'm trying to follow this recommendation, but applying it to Emacs/eglot instead. I can't seem to get it to take effect though. I can see the following message is passed to rust-analyzer
But when I strace rust-analyzer, I still see
I must be missing something obvious. I'm new to a lot of these tools, so I'm still fuzzy on how exactly everything strings together. Any hints would be greatly appreciated. EDIT: I was able to figure out my issue. My Emacs/eglot configuration was such that the client was returning |
@crawford See joaotavora/eglot#845 - rust-analyzer is "quirky" in that it doesn't support For the moment you need to use a snippet like this, adapted to your settings of course: ;; Rust-analyzer is "quirky", and doesn't support updating its
;; configuration settings once it's running. This means that eglot
;; has to configure it *before* it runs, which it doesn't do by
;; default.
;;
;; See also https://rust-analyzer.github.io/manual.html#configuration
(cl-defmethod eglot-initialization-options ((server eglot-lsp-server))
(pcase (eglot--major-mode server)
('rust-mode '(:checkOnSave
(:command "clippy")))
(_ (eglot--{})))) Also note that, unlike all other lsp server implementations I've seen, rust-analyzer doesn't take a I'm sure there are good reasons for this quirkiness. I'm actually here to see if others have done this before, to check if there's wisdom to start from, but apparently I'm in novel terrain here. Shame, really, eglot is much nicer to use than lsp-mode and could use some more community mindshare. |
When working with RTFM, rust-analyzer constantly complains it
can't find crate for 'test'
, since there is no std available for this target architecture.cargo check
is always called with-all-targets
, but I would like to call it with just--bins
for this project.The text was updated successfully, but these errors were encountered: