Skip to content

Commit 7a9ba16

Browse files
bors[bot]zoechi
andauthored
Merge #4158
4158: Clarify rust-analyzer binary install r=matklad a=zoechi Co-authored-by: Günter Zöchbauer <[email protected]>
2 parents 99c2871 + 999e331 commit 7a9ba16

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

docs/user/readme.adoc

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/readme.adoc
2323

2424
== Installation
2525

26-
In theory, one should be able to just install the server binary and have it automatically work with any editor.
26+
In theory, one should be able to just install the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>> and have it automatically work with any editor.
2727
We are not there yet, so some editor specific setup is required.
2828

2929
Additionally, rust-analyzer needs the sources of the standard library.
@@ -108,15 +108,26 @@ Here are some useful self-diagnostic commands:
108108
* To log all LSP requests, add `"rust-analyzer.trace.server": "verbose"` to the settings and look for `Server Trace` in the panel.
109109
* To enable client-side logging, add `"rust-analyzer.trace.extension": true` to the settings and open the `Console` tab of VS Code developer tools.
110110

111-
=== Language Server Binary
111+
=== rust-analyzer Language Server Binary
112112

113113
Other editors generally require the `rust-analyzer` binary to be in `$PATH`.
114114
You can download the pre-built binary from the https://github.com/rust-analyzer/rust-analyzer/releases[releases] page. Typically, you then need to rename the binary for your platform, e.g. `rust-analyzer-mac` if you're on Mac OS, to `rust-analzyer` and make it executable in addition to moving it into a directory in your `$PATH`.
115115

116+
On Linux to install the `rust-analyzer` binary into `~/.local/bin`, this commands could be used
117+
118+
[source,bash]
119+
----
120+
$ curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-linux -o ~/.local/bin/rust-analyzer
121+
$ chmod +x ~/.local/bin/rust-analyzer
122+
----
123+
124+
Ensure `~/.local/bin` is listed in the `$PATH` variable.
125+
116126
Alternatively, you can install it from source using the following command:
117127

118128
[source,bash]
119129
----
130+
$ git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyzer
120131
$ cargo xtask install --server
121132
----
122133

@@ -139,15 +150,19 @@ $ yay -S rust-analyzer-bin
139150

140151
=== Emacs
141152

142-
Emacs support is maintained https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-rust.el[upstream].
153+
Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
143154

144-
1. Install the most recent version of `emacs-lsp` package by following the instructions https://github.com/emacs-lsp/lsp-mode[here].
155+
Emacs support is maintained as part of the https://github.com/emacs-lsp/lsp-mode[Emacs-LSP] package in https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-rust.el[lsp-rust.el].
156+
157+
1. Install the most recent version of `emacs-lsp` package by following the https://github.com/emacs-lsp/lsp-mode[Emacs-LSP instructions].
145158
2. Set `lsp-rust-server` to `'rust-analyzer`.
146159
3. Run `lsp` in a Rust buffer.
147160
4. (Optionally) bind commands like `lsp-rust-analyzer-join-lines`, `lsp-extend-selection` and `lsp-rust-analyzer-expand-macro` to keys.
148161

149162
=== Vim
150163

164+
Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
165+
151166
The are several LSP client implementations for vim:
152167

153168
==== coc-rust-analyzer
@@ -205,7 +220,7 @@ Once `neovim/nvim-lsp` is installed, use `+lua require'nvim_lsp'.rust_analyzer.s
205220

206221
=== Sublime Text 3
207222

208-
Prerequisites: You have installed the <<language-server-binary,`rust-analyzer` binary>>.
223+
Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
209224

210225
You also need the `LSP` package. To install it:
211226

@@ -218,7 +233,7 @@ Finally, with your Rust project open, in the command palette, run `LSP: Enable L
218233

219234
If it worked, you should see "rust-analzyer, Line X, Column Y" on the left side of the bottom bar, and after waiting a bit, functionality like tooltips on hovering over variables should become available.
220235

221-
If you get an error saying `No such file or directory: 'rust-analyzer'`, see the <<language-server-binary,section on installing the language server binary>>.
236+
If you get an error saying `No such file or directory: 'rust-analyzer'`, see the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>> section on installing the language server binary.
222237

223238
== Usage
224239

0 commit comments

Comments
 (0)