diff options
Diffstat (limited to 'src/tools/rust-analyzer/docs/user/manual.adoc')
-rw-r--r-- | src/tools/rust-analyzer/docs/user/manual.adoc | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/tools/rust-analyzer/docs/user/manual.adoc b/src/tools/rust-analyzer/docs/user/manual.adoc index cb96feeb5..b5c095fd9 100644 --- a/src/tools/rust-analyzer/docs/user/manual.adoc +++ b/src/tools/rust-analyzer/docs/user/manual.adoc @@ -172,7 +172,7 @@ $ cargo xtask install --server If your editor can't find the binary even though the binary is on your `$PATH`, the likely explanation is that it doesn't see the same `$PATH` as the shell, see https://github.com/rust-lang/rust-analyzer/issues/1811[this issue]. On Unix, running the editor from a shell or changing the `.desktop` file to set the environment should help. -==== `rustup` +==== rustup `rust-analyzer` is available in `rustup`: @@ -181,19 +181,6 @@ On Unix, running the editor from a shell or changing the `.desktop` file to set $ rustup component add rust-analyzer ---- -However, in contrast to `component add clippy` or `component add rustfmt`, this does not actually place a `rust-analyzer` binary in `~/.cargo/bin`, see https://github.com/rust-lang/rustup/issues/2411[this issue]. You can find the path to the binary using: -[source,bash] ----- -$ rustup which --toolchain stable rust-analyzer ----- -You can link to there from `~/.cargo/bin` or configure your editor to use the full path. - -Alternatively you might be able to configure your editor to start `rust-analyzer` using the command: -[source,bash] ----- -$ rustup run stable rust-analyzer ----- - ==== Arch Linux The `rust-analyzer` binary can be installed from the repos or AUR (Arch User Repository): @@ -257,7 +244,7 @@ Any other tools or libraries you will need to acquire from Flatpak. Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. -To use `rust-analyzer`, you need to install and enable one of the two popular two popular LSP client implementations for Emacs, https://github.com/joaotavora/eglot[Eglot] or https://github.com/emacs-lsp/lsp-mode[LSP Mode]. Both enable `rust-analyzer` by default in rust buffers if it is available. +To use `rust-analyzer`, you need to install and enable one of the two popular LSP client implementations for Emacs, https://github.com/joaotavora/eglot[Eglot] or https://github.com/emacs-lsp/lsp-mode[LSP Mode]. Both enable `rust-analyzer` by default in rust buffers if it is available. ==== Eglot @@ -589,7 +576,7 @@ Try **rust-analyzer: Show RA Version** in VS Code (using **Command Palette** fea If the date is more than a week ago, it's better to update rust-analyzer version. The next thing to check would be panic messages in rust-analyzer's log. -Log messages are printed to stderr, in VS Code you can see then in the `Output > Rust Analyzer Language Server` tab of the panel. +Log messages are printed to stderr, in VS Code you can see them in the `Output > Rust Analyzer Language Server` tab of the panel. To see more logs, set the `RA_LOG=info` environment variable, this can be done either by setting the environment variable manually or by using `rust-analyzer.server.extraEnv`, note that both of these approaches require the server to be restarted. To fully capture LSP messages between the editor and the server, set `"rust-analyzer.trace.server": "verbose"` config and check @@ -666,9 +653,28 @@ However, if you use some other build system, you'll have to describe the structu [source,TypeScript] ---- interface JsonProject { + /// Path to the sysroot directory. + /// + /// The sysroot is where rustc looks for the + /// crates that are built-in to rust, such as + /// std. + /// + /// https://doc.rust-lang.org/rustc/command-line-arguments.html#--sysroot-override-the-system-root + /// + /// To see the current value of sysroot, you + /// can query rustc: + /// + /// ``` + /// $ rustc --print sysroot + /// /Users/yourname/.rustup/toolchains/stable-x86_64-apple-darwin + /// ``` + sysroot?: string; /// Path to the directory with *source code* of /// sysroot crates. /// + /// By default, this is `lib/rustlib/src/rust/library` + /// relative to the sysroot. + /// /// It should point to the directory where std, /// core, and friends can be found: /// |