diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:28 +0000 |
commit | 94a0819fe3a0d679c3042a77bfe6a2afc505daea (patch) | |
tree | 2b827afe6a05f3538db3f7803a88c4587fe85648 /src/tools/rust-analyzer/docs/user/manual.adoc | |
parent | Adding upstream version 1.64.0+dfsg1. (diff) | |
download | rustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.tar.xz rustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.zip |
Adding upstream version 1.66.0+dfsg1.upstream/1.66.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/rust-analyzer/docs/user/manual.adoc')
-rw-r--r-- | src/tools/rust-analyzer/docs/user/manual.adoc | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/tools/rust-analyzer/docs/user/manual.adoc b/src/tools/rust-analyzer/docs/user/manual.adoc index 999a6437a..c30838e5f 100644 --- a/src/tools/rust-analyzer/docs/user/manual.adoc +++ b/src/tools/rust-analyzer/docs/user/manual.adoc @@ -174,14 +174,25 @@ On Unix, running the editor from a shell or changing the `.desktop` file to set ==== `rustup` -`rust-analyzer` is available in `rustup`, but only in the nightly toolchain: +`rust-analyzer` is available in `rustup`: [source,bash] ---- -$ rustup +nightly component add rust-analyzer-preview +$ 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]. +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 @@ -479,7 +490,7 @@ You can follow instructions for installing <<rust-analyzer-language-server-binar == Troubleshooting Start with looking at the rust-analyzer version. -Try **Rust Analyzer: Show RA Version** in VS Code (using **Command Palette** feature typically activated by Ctrl+Shift+P) or `rust-analyzer --version` in the command line. +Try **rust-analyzer: Show RA Version** in VS Code (using **Command Palette** feature typically activated by Ctrl+Shift+P) or `rust-analyzer --version` in the command line. 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. @@ -492,7 +503,7 @@ To fully capture LSP messages between the editor and the server, set `"rust-anal The root cause for many "`nothing works`" problems is that rust-analyzer fails to understand the project structure. To debug that, first note the `rust-analyzer` section in the status bar. If it has an error icon and red, that's the problem (hover will have somewhat helpful error message). -**Rust Analyzer: Status** prints dependency information for the current file. +**rust-analyzer: Status** prints dependency information for the current file. Finally, `RA_LOG=project_model=debug` enables verbose logs during project loading. If rust-analyzer outright crashes, try running `rust-analyzer analysis-stats /path/to/project/directory/` on the command line. @@ -861,3 +872,14 @@ For example, if you want to run https://crates.io/crates/cargo-watch[`cargo watc "isBackground": true } ``` + +==== Live Share + +VS Code Live Share has partial support for rust-analyzer. + +Live Share _requires_ the official Microsoft build of VS Code, OSS builds will not work correctly. + +The host's rust-analyzer instance will be shared with all guests joining the session. +The guests do not have to have the rust-analyzer extension installed for this to work. + +If you are joining a Live Share session and _do_ have rust-analyzer installed locally, commands from the command palette will not work correctly since they will attempt to communicate with the local server. |