aboutsummaryrefslogtreecommitdiff
path: root/docs/user/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/user/README.md')
-rw-r--r--docs/user/README.md59
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
6you should be able to use it with any LSP-compatible editor. We use custom 6you should be able to use it with any LSP-compatible editor. We use custom
7extensions to LSP, so special client-side support is required to take full 7extensions to LSP, so special client-side support is required to take full
8advantage of rust-analyzer. This repository contains support code for VS Code 8advantage of rust-analyzer. This repository contains support code for VS Code.
9and 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
32You will also need the most recent version of VS Code: we don't try to 31You will also need the most recent version of VS Code: we don't try to
33maintain compatibility with older versions yet. 32maintain compatibility with older versions yet.
34 33
35The experimental VS Code plugin can then be built and installed by executing the 34### Installation from prebuilt binaries
35
36We ship prebuilt binaries for Linux, Mac and Windows via
37[GitHub releases](https://github.com/rust-analyzer/rust-analyzer/releases).
38In order to use them you need to install the client VSCode extension.
39
40Publishing 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```
46Then open VSCode (or reload the window if it was already running), open some Rust project and you should
47see 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
53Click `Download now`, wait until the progress is 100% and you are ready to go.
54
55For updates you need to remove installed binary
56```
57rm -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
65The experimental VS Code plugin can be built and installed by executing the
36following commands: 66following 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
49need to turn off the `rust-analyzer.enableEnhancedTyping` setting. 79need 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
51If you have an unusual setup (for example, `code` is not in the `PATH`), you 82If you have an unusual setup (for example, `code` is not in the `PATH`), you
52should adapt these manual installation instructions: 83should 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
133Prerequisites: 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
137Installation:
138 168
139* add 169[emacs-lsp]: https://github.com/emacs-lsp/lsp-mode
140[rust-analyzer.el](../../editors/emacs/rust-analyzer.el)
141to 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
174NeoVim 0.5 (not yet released) has built in language server support. For a quick start configuration 200NeoVim 0.5 (not yet released) has built in language server support. For a quick start configuration
175of rust-analyzer, use [neovim/nvim-lsp](https://github.com/neovim/nvim-lsp#rust_analyzer). 201of rust-analyzer, use [neovim/nvim-lsp](https://github.com/neovim/nvim-lsp#rust_analyzer).
176Once `neovim/nvim-lsp` is installed, you can use `call nvim_lsp#setup("rust_analyzer", {})` 202Once `neovim/nvim-lsp` is installed, use `lua require'nvim_lsp'.rust_analyzer.setup({})` in your `init.vim`.
177or `lua require'nvim_lsp'.rust_analyzer.setup({})` to quickly get set up.
178 203
179 204
180## Sublime Text 3 205## Sublime Text 3