diff options
Diffstat (limited to 'docs/user/README.md')
-rw-r--r-- | docs/user/README.md | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/docs/user/README.md b/docs/user/README.md new file mode 100644 index 000000000..439c4e6ae --- /dev/null +++ b/docs/user/README.md | |||
@@ -0,0 +1,77 @@ | |||
1 | The main interface to rust-analyzer is the | ||
2 | [LSP](https://microsoft.github.io/language-server-protocol/) implementation. To | ||
3 | install lsp server, use `cargo install-lsp`, which is a shorthand for `cargo | ||
4 | install --package ra_lsp_server`. The binary is named `ra_lsp_server`, you | ||
5 | should be able to use it with any LSP-compatible editor. We use custom | ||
6 | extensions to LSP, so special client-side support is required to take full | ||
7 | advantage of rust-analyzer. This repository contains support code for VS Code | ||
8 | and Emacs. | ||
9 | |||
10 | Rust Analyzer needs sources of rust standard library to work, so you might need | ||
11 | to execute | ||
12 | |||
13 | ``` | ||
14 | $ rustup component add rust-src | ||
15 | ``` | ||
16 | |||
17 | See [./features.md](./features.md) document for a list of features that are available. | ||
18 | |||
19 | ## VS Code | ||
20 | |||
21 | Prerequisites: | ||
22 | |||
23 | In order to build the VS Code plugin, you need to have node.js and npm with | ||
24 | a minimum version of 10 installed. Please refer to | ||
25 | [node.js and npm documentation](https://nodejs.org) for installation instructions. | ||
26 | |||
27 | You will also need the most recent version of VS Code: we don't try to | ||
28 | maintain compatibility with older versions yet. | ||
29 | |||
30 | The experimental VS Code plugin can then be built and installed by executing the | ||
31 | following commands: | ||
32 | |||
33 | ``` | ||
34 | $ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1 | ||
35 | $ cd rust-analyzer | ||
36 | $ cargo install-code | ||
37 | ``` | ||
38 | |||
39 | This will run `cargo install --package ra_lsp_server` to install the server | ||
40 | binary into `~/.cargo/bin`, and then will build and install plugin from | ||
41 | `editors/code`. See | ||
42 | [this](https://github.com/rust-analyzer/rust-analyzer/blob/69ee5c9c5ef212f7911028c9ddf581559e6565c3/crates/tools/src/main.rs#L37-L56) | ||
43 | for details. The installation is expected to *just work*, if it doesn't, report | ||
44 | bugs! | ||
45 | |||
46 | It's better to remove existing Rust plugins to avoid interference. | ||
47 | |||
48 | Beyond basic LSP features, there are some extension commands which you can | ||
49 | invoke via <kbd>Ctrl+Shift+P</kbd> or bind to a shortcut. See [./features.md](./features.md) | ||
50 | for details. | ||
51 | |||
52 | ### Settings | ||
53 | |||
54 | * `rust-analyzer.highlightingOn`: enables experimental syntax highlighting | ||
55 | * `rust-analyzer.showWorkspaceLoadedNotification`: to ease troubleshooting, a | ||
56 | notification is shown by default when a workspace is loaded | ||
57 | * `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts | ||
58 | `Enter` key to make it easier to continue comments | ||
59 | * `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable | ||
60 | * `rust-analyzer.enableCargoWatchOnStartup`: prompt to install & enable `cargo | ||
61 | watch` for live error highlighting (note, this **does not** use rust-analyzer) | ||
62 | * `rust-analyzer.trace.server`: enables internal logging | ||
63 | |||
64 | |||
65 | ## Emacs | ||
66 | |||
67 | Prerequisites: | ||
68 | |||
69 | `emacs-lsp`, `dash` and `ht` packages. | ||
70 | |||
71 | Installation: | ||
72 | |||
73 | * add | ||
74 | [ra-emacs-lsp.el](https://github.com/rust-analyzer/rust-analyzer/blob/69ee5c9c5ef212f7911028c9ddf581559e6565c3/editors/emacs/ra-emacs-lsp.el) | ||
75 | to load path and require it in `init.el` | ||
76 | * run `lsp` in a rust buffer | ||
77 | * (Optionally) bind commands like `rust-analyzer-join-lines` or `rust-analyzer-extend-selection` to keys | ||