diff options
author | Günter Zöchbauer <[email protected]> | 2020-04-26 14:44:05 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-26 14:44:05 +0100 |
commit | 49d494c03307cff75057a856eadc5ebb5ff1ea9d (patch) | |
tree | 32d96e33fc5d0c7def57456885b4905b4ee79427 /docs | |
parent | ef67e0a497a3f0b65c11bf443e0d35c8e51bd26f (diff) |
Clarify rust-analyzer binary install
Diffstat (limited to 'docs')
-rw-r--r-- | docs/user/readme.adoc | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/docs/user/readme.adoc b/docs/user/readme.adoc index ce5704836..5e4ce3055 100644 --- a/docs/user/readme.adoc +++ b/docs/user/readme.adoc | |||
@@ -23,7 +23,7 @@ https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/readme.adoc | |||
23 | 23 | ||
24 | == Installation | 24 | == Installation |
25 | 25 | ||
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. |
27 | We are not there yet, so some editor specific setup is required. | 27 | We are not there yet, so some editor specific setup is required. |
28 | 28 | ||
29 | Additionally, rust-analyzer needs the sources of the standard library. | 29 | Additionally, rust-analyzer needs the sources of the standard library. |
@@ -94,7 +94,8 @@ $ git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyz | |||
94 | $ cargo xtask install | 94 | $ cargo xtask install |
95 | ---- | 95 | ---- |
96 | 96 | ||
97 | You'll need Cargo, nodejs and npm for this. | 97 | You'll need Cargo, xtask, nodejs and npm for this. |
98 | Cargo-xtask can be found at https://github.com/matklad/cargo-xtask | ||
98 | 99 | ||
99 | Note that installing via `xtask install` does not work for VS Code Remote, instead you'll need to install the `.vsix` manually. | 100 | Note that installing via `xtask install` does not work for VS Code Remote, instead you'll need to install the `.vsix` manually. |
100 | 101 | ||
@@ -108,18 +109,29 @@ Here are some useful self-diagnostic commands: | |||
108 | * To log all LSP requests, add `"rust-analyzer.trace.server": "verbose"` to the settings and look for `Server Trace` in the panel. | 109 | * To log all LSP requests, add `"rust-analyzer.trace.server": "verbose"` to the settings and look for `Server Trace` in the panel. |
109 | * To enable client-side logging, add `"rust-analyzer.trace.extension": true` to the settings and open the `Console` tab of VS Code developer tools. | 110 | * To enable client-side logging, add `"rust-analyzer.trace.extension": true` to the settings and open the `Console` tab of VS Code developer tools. |
110 | 111 | ||
111 | === Language Server Binary | 112 | === rust-analyzer Language Server Binary |
112 | 113 | ||
113 | Other editors generally require the `rust-analyzer` binary to be in `$PATH`. | 114 | Other editors generally require the `rust-analyzer` binary to be in `$PATH`. |
114 | 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`. | 115 | 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`. |
115 | 116 | ||
117 | On Linux to install the `rust-analyzer` binary into `~/.cargo/bin` which usually is already added to `$PATH`, this commands could be used | ||
118 | |||
119 | [source,bash] | ||
120 | ---- | ||
121 | $ curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-linux -o ~/.cargo/bin/rust-analyzer | ||
122 | $ chmod +x ~/.cargo/bin/rust-analyzer | ||
123 | ---- | ||
124 | |||
116 | Alternatively, you can install it from source using the following command: | 125 | Alternatively, you can install it from source using the following command: |
117 | 126 | ||
118 | [source,bash] | 127 | [source,bash] |
119 | ---- | 128 | ---- |
129 | $ git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyzer | ||
120 | $ cargo xtask install --server | 130 | $ cargo xtask install --server |
121 | ---- | 131 | ---- |
122 | 132 | ||
133 | Cargo-xtask can be found at https://github.com/matklad/cargo-xtask | ||
134 | |||
123 | 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-analyzer/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. | 135 | 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-analyzer/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. |
124 | 136 | ||
125 | ==== Arch Linux | 137 | ==== Arch Linux |
@@ -139,15 +151,19 @@ $ yay -S rust-analyzer-bin | |||
139 | 151 | ||
140 | === Emacs | 152 | === Emacs |
141 | 153 | ||
142 | Emacs support is maintained https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-rust.el[upstream]. | 154 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. |
143 | 155 | ||
144 | 1. Install the most recent version of `emacs-lsp` package by following the instructions https://github.com/emacs-lsp/lsp-mode[here]. | 156 | 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]. |
157 | |||
158 | 1. Install the most recent version of `emacs-lsp` package by following the https://github.com/emacs-lsp/lsp-mode[Emacs-LSP instructions]. | ||
145 | 2. Set `lsp-rust-server` to `'rust-analyzer`. | 159 | 2. Set `lsp-rust-server` to `'rust-analyzer`. |
146 | 3. Run `lsp` in a Rust buffer. | 160 | 3. Run `lsp` in a Rust buffer. |
147 | 4. (Optionally) bind commands like `lsp-rust-analyzer-join-lines`, `lsp-extend-selection` and `lsp-rust-analyzer-expand-macro` to keys. | 161 | 4. (Optionally) bind commands like `lsp-rust-analyzer-join-lines`, `lsp-extend-selection` and `lsp-rust-analyzer-expand-macro` to keys. |
148 | 162 | ||
149 | === Vim | 163 | === Vim |
150 | 164 | ||
165 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. | ||
166 | |||
151 | The are several LSP client implementations for vim: | 167 | The are several LSP client implementations for vim: |
152 | 168 | ||
153 | ==== coc-rust-analyzer | 169 | ==== coc-rust-analyzer |
@@ -205,7 +221,7 @@ Once `neovim/nvim-lsp` is installed, use `+lua require'nvim_lsp'.rust_analyzer.s | |||
205 | 221 | ||
206 | === Sublime Text 3 | 222 | === Sublime Text 3 |
207 | 223 | ||
208 | Prerequisites: You have installed the <<language-server-binary,`rust-analyzer` binary>>. | 224 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. |
209 | 225 | ||
210 | You also need the `LSP` package. To install it: | 226 | You also need the `LSP` package. To install it: |
211 | 227 | ||
@@ -218,7 +234,7 @@ Finally, with your Rust project open, in the command palette, run `LSP: Enable L | |||
218 | 234 | ||
219 | 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. | 235 | 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. |
220 | 236 | ||
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>>. | 237 | 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. |
222 | 238 | ||
223 | == Usage | 239 | == Usage |
224 | 240 | ||