diff options
author | Kevin DeLorey <[email protected]> | 2020-02-09 16:25:47 +0000 |
---|---|---|
committer | Kevin DeLorey <[email protected]> | 2020-02-09 16:37:43 +0000 |
commit | a957c473fdb79880c39b73dc9e0c923093cf16ac (patch) | |
tree | f998b548f530ce604651e0e6af314ed2ec74b3b5 /docs/user/README.md | |
parent | 22caf982b99c54058e2e9200aeea0e61cada284a (diff) | |
parent | 1b9b13b4b4a75b5531c3f046ce6bf72d681f2732 (diff) |
Merge branch 'master' into kdelorey/complete-trait-impl
Diffstat (limited to 'docs/user/README.md')
-rw-r--r-- | docs/user/README.md | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/docs/user/README.md b/docs/user/README.md index 9d3258c06..3da30a193 100644 --- a/docs/user/README.md +++ b/docs/user/README.md | |||
@@ -5,8 +5,7 @@ install lsp server, clone the repository and then run `cargo xtask install | |||
5 | ./crates/ra_lsp_server`). This will produce a binary named `ra_lsp_server` which | 5 | ./crates/ra_lsp_server`). This will produce a binary named `ra_lsp_server` which |
6 | you should be able to use it with any LSP-compatible editor. We use custom | 6 | you should be able to use it with any LSP-compatible editor. We use custom |
7 | extensions to LSP, so special client-side support is required to take full | 7 | extensions to LSP, so special client-side support is required to take full |
8 | advantage of rust-analyzer. This repository contains support code for VS Code | 8 | advantage of rust-analyzer. This repository contains support code for VS Code. |
9 | and Emacs. | ||
10 | 9 | ||
11 | ``` | 10 | ``` |
12 | $ git clone [email protected]:rust-analyzer/rust-analyzer && cd rust-analyzer | 11 | $ git clone [email protected]:rust-analyzer/rust-analyzer && cd rust-analyzer |
@@ -32,7 +31,38 @@ a minimum version of 10 installed. Please refer to | |||
32 | You will also need the most recent version of VS Code: we don't try to | 31 | You will also need the most recent version of VS Code: we don't try to |
33 | maintain compatibility with older versions yet. | 32 | maintain compatibility with older versions yet. |
34 | 33 | ||
35 | The experimental VS Code plugin can then be built and installed by executing the | 34 | ### Installation from prebuilt binaries |
35 | |||
36 | We ship prebuilt binaries for Linux, Mac and Windows via | ||
37 | [GitHub releases](https://github.com/rust-analyzer/rust-analyzer/releases). | ||
38 | In order to use them you need to install the client VSCode extension. | ||
39 | |||
40 | Publishing to VSCode marketplace is currently WIP. Thus, you need to clone the repository and install **only** the client extension via | ||
41 | ``` | ||
42 | $ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1 | ||
43 | $ cd rust-analyzer | ||
44 | $ cargo xtask install --client-code | ||
45 | ``` | ||
46 | Then open VSCode (or reload the window if it was already running), open some Rust project and you should | ||
47 | see an info message pop-up. | ||
48 | |||
49 | |||
50 | <img height="140px" src="https://user-images.githubusercontent.com/36276403/74103174-a40df100-4b52-11ea-81f4-372c70797924.png" alt="Download now message"/> | ||
51 | |||
52 | |||
53 | Click `Download now`, wait until the progress is 100% and you are ready to go. | ||
54 | |||
55 | For updates you need to remove installed binary | ||
56 | ``` | ||
57 | rm -rf ${HOME}/.config/Code/User/globalStorage/matklad.rust-analyzer | ||
58 | ``` | ||
59 | |||
60 | `"Donwload latest language server"` command for VSCode and automatic updates detection is currently WIP. | ||
61 | |||
62 | |||
63 | ### Installation from sources | ||
64 | |||
65 | The experimental VS Code plugin can be built and installed by executing the | ||
36 | following commands: | 66 | following commands: |
37 | 67 | ||
38 | ``` | 68 | ``` |
@@ -47,6 +77,7 @@ doesn't, report bugs! | |||
47 | **Note** [#1831](https://github.com/rust-analyzer/rust-analyzer/issues/1831): If you are using the popular | 77 | **Note** [#1831](https://github.com/rust-analyzer/rust-analyzer/issues/1831): If you are using the popular |
48 | [Vim emulation plugin](https://github.com/VSCodeVim/Vim), you will likely | 78 | [Vim emulation plugin](https://github.com/VSCodeVim/Vim), you will likely |
49 | need to turn off the `rust-analyzer.enableEnhancedTyping` setting. | 79 | need to turn off the `rust-analyzer.enableEnhancedTyping` setting. |
80 | (// TODO: This configuration is no longer available, enhanced typing shoud be disabled via removing Enter key binding, [see this issue](https://github.com/rust-analyzer/rust-analyzer/issues/3051)) | ||
50 | 81 | ||
51 | If you have an unusual setup (for example, `code` is not in the `PATH`), you | 82 | If you have an unusual setup (for example, `code` is not in the `PATH`), you |
52 | should adapt these manual installation instructions: | 83 | should adapt these manual installation instructions: |
@@ -57,7 +88,7 @@ $ cd rust-analyzer | |||
57 | $ cargo install --path ./crates/ra_lsp_server/ --force --locked | 88 | $ cargo install --path ./crates/ra_lsp_server/ --force --locked |
58 | $ cd ./editors/code | 89 | $ cd ./editors/code |
59 | $ npm install | 90 | $ npm install |
60 | $ ./node_modules/vsce/out/vsce package | 91 | $ npm run package |
61 | $ code --install-extension ./rust-analyzer-0.1.0.vsix | 92 | $ code --install-extension ./rust-analyzer-0.1.0.vsix |
62 | ``` | 93 | ``` |
63 | 94 | ||
@@ -94,7 +125,7 @@ host. | |||
94 | * `rust-analyzer.highlightingOn`: enables experimental syntax highlighting. | 125 | * `rust-analyzer.highlightingOn`: enables experimental syntax highlighting. |
95 | Colors can be configured via `editor.tokenColorCustomizations`. | 126 | Colors can be configured via `editor.tokenColorCustomizations`. |
96 | As an example, [Pale Fire](https://github.com/matklad/pale-fire/) color scheme tweaks rust colors. | 127 | As an example, [Pale Fire](https://github.com/matklad/pale-fire/) color scheme tweaks rust colors. |
97 | * `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts. | 128 | * `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts the |
98 | `Enter` key to make it easier to continue comments. Note that it may conflict with VIM emulation plugin. | 129 | `Enter` key to make it easier to continue comments. Note that it may conflict with VIM emulation plugin. |
99 | * `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable | 130 | * `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable |
100 | * `rust-analyzer.enableCargoWatchOnStartup`: prompt to install & enable `cargo | 131 | * `rust-analyzer.enableCargoWatchOnStartup`: prompt to install & enable `cargo |
@@ -130,17 +161,12 @@ host. | |||
130 | 161 | ||
131 | ## Emacs | 162 | ## Emacs |
132 | 163 | ||
133 | Prerequisites: | 164 | * install recent version of `emacs-lsp` package by following the instructions [here][emacs-lsp] |
134 | 165 | * set `lsp-rust-server` to `'rust-analyzer` | |
135 | `emacs-lsp`, `dash` and `ht` packages. | 166 | * run `lsp` in a Rust buffer |
136 | 167 | * (Optionally) bind commands like `lsp-rust-analyzer-join-lines`, `lsp-extend-selection` and `lsp-rust-analyzer-expand-macro` to keys | |
137 | Installation: | ||
138 | 168 | ||
139 | * add | 169 | [emacs-lsp]: https://github.com/emacs-lsp/lsp-mode |
140 | [rust-analyzer.el](../../editors/emacs/rust-analyzer.el) | ||
141 | to load path and require it in `init.el` | ||
142 | * run `lsp` in a rust buffer | ||
143 | * (Optionally) bind commands like `rust-analyzer-join-lines`, `rust-analyzer-extend-selection` and `rust-analyzer-expand-macro` to keys, and enable `rust-analyzer-inlay-hints-mode` to get inline type hints | ||
144 | 170 | ||
145 | 171 | ||
146 | ## Vim and NeoVim (coc-rust-analyzer) | 172 | ## Vim and NeoVim (coc-rust-analyzer) |
@@ -173,8 +199,7 @@ let g:LanguageClient_serverCommands = { | |||
173 | 199 | ||
174 | NeoVim 0.5 (not yet released) has built in language server support. For a quick start configuration | 200 | NeoVim 0.5 (not yet released) has built in language server support. For a quick start configuration |
175 | of rust-analyzer, use [neovim/nvim-lsp](https://github.com/neovim/nvim-lsp#rust_analyzer). | 201 | of rust-analyzer, use [neovim/nvim-lsp](https://github.com/neovim/nvim-lsp#rust_analyzer). |
176 | Once `neovim/nvim-lsp` is installed, you can use `call nvim_lsp#setup("rust_analyzer", {})` | 202 | Once `neovim/nvim-lsp` is installed, use `lua require'nvim_lsp'.rust_analyzer.setup({})` in your `init.vim`. |
177 | or `lua require'nvim_lsp'.rust_analyzer.setup({})` to quickly get set up. | ||
178 | 203 | ||
179 | 204 | ||
180 | ## Sublime Text 3 | 205 | ## Sublime Text 3 |