rust-analyzer: Doom Emacs code suggestions do not work for std, works for rls
rust-analyzer version: (eg. output of “Rust Analyzer: Show RA Version” command) dev-util/rust-analyzer Latest version available: 20220222 Latest version installed: 20220222 Size of files: 33.387 KiB Homepage: https://rust-analyzer.github.io Description: An implementation of Language Server Protocol for the Rust programming language License: 0BSD Apache-2.0 Artistic-2 BSD Boost-1.0 CC0-1.0 ISC MIT Unlicense ZLIB
rustc version: (eg. output of rustc -V)
rustc 1.58.1-nightly (gentoo)
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)
which rustc
/usr/bin/rustc
which cargo /usr/bin/cargo
Steps to reproduce:
- install rust via portage with use flags clippy, nightly, rls, rust-src and rustfmt
- install fresh emacs via portage
- install doom emacs on top of that with
~/.emacs.d/bin/doom install - enable lsp and (rust +lsp) in ~/.doom.d/init.el (company mode code suggestion are already enabled by default)
- put (after! rustic (setq rustic-lsp-server 'rust-analyzer)) into ~/.doom.d/config.el so rust-analyzer is loaded instead of rls when opening a .rs
- run ~/.emacs.d/bin/doom
So I do not get code suggestions from company-mode for std things. It works for code snippets like fn, if etc.
I tried changing RUST_SRC_PATH to
/usr/lib/rust/1.58.1/lib/rustlib/src/rust/library/ and /usr/lib/rust/1.58.1/lib/rustlib/src/rust/src via export in zsh, then doing the ~/.emacs.d/bin/doom env dance to have this environment variable in doom emacs as well. The environment variable exists in ~/.emacs.d/.local/env.
In the minibuffer it says LSP :: Error from the Language Server: waiting for cargo metadata or cargo check (Unknown error) [2 times]
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (7 by maintainers)
You can do this to fix your project to work with rust analyzer until that PR is merged:
works like a charm. you guys are awesome! thanks
but now I have to learn some rust then instead of playing around with emacs all day long… 😄
sorry about that then. And thanks for your time and help. I am going to close this here.