diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/debugging.md | 8 | ||||
-rw-r--r-- | docs/user/assists.md | 12 | ||||
-rw-r--r-- | docs/user/readme.adoc | 35 |
3 files changed, 32 insertions, 23 deletions
diff --git a/docs/dev/debugging.md b/docs/dev/debugging.md index bece6a572..1aa392935 100644 --- a/docs/dev/debugging.md +++ b/docs/dev/debugging.md | |||
@@ -26,7 +26,7 @@ where **only** the `rust-analyzer` extension being debugged is enabled. | |||
26 | - `Run Extension (Dev Server)` - runs extension with the locally built LSP server (`target/debug/rust-analyzer`). | 26 | - `Run Extension (Dev Server)` - runs extension with the locally built LSP server (`target/debug/rust-analyzer`). |
27 | 27 | ||
28 | TypeScript debugging is configured to watch your source edits and recompile. | 28 | TypeScript debugging is configured to watch your source edits and recompile. |
29 | To apply changes to an already running debug process press <kbd>Ctrl+Shift+P</kbd> and run the following command in your `[Extension Development Host]` | 29 | To apply changes to an already running debug process, press <kbd>Ctrl+Shift+P</kbd> and run the following command in your `[Extension Development Host]` |
30 | 30 | ||
31 | ``` | 31 | ``` |
32 | > Developer: Reload Window | 32 | > Developer: Reload Window |
@@ -76,11 +76,11 @@ Make sure you open a rust file in the `[Extension Development Host]` and try aga | |||
76 | 76 | ||
77 | Make sure you have run `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`. | 77 | Make sure you have run `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`. |
78 | 78 | ||
79 | By default this should reset back to 1 everytime you log in. | 79 | By default this should reset back to 1 every time you log in. |
80 | 80 | ||
81 | ### Breakpoints are never being hit | 81 | ### Breakpoints are never being hit |
82 | 82 | ||
83 | Check your version of `lldb` if it's version 6 and lower use the `classic` adapter type. | 83 | Check your version of `lldb`. If it's version 6 and lower, use the `classic` adapter type. |
84 | It's `lldb.adapterType` in settings file. | 84 | It's `lldb.adapterType` in settings file. |
85 | 85 | ||
86 | If you're running `lldb` version 7 change the lldb adapter type to `bundled` or `native`. | 86 | If you're running `lldb` version 7, change the lldb adapter type to `bundled` or `native`. |
diff --git a/docs/user/assists.md b/docs/user/assists.md index ee515949e..692fd4f52 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -241,6 +241,18 @@ fn main() { | |||
241 | } | 241 | } |
242 | ``` | 242 | ``` |
243 | 243 | ||
244 | ## `change_return_type_to_result` | ||
245 | |||
246 | Change the function's return type to Result. | ||
247 | |||
248 | ```rust | ||
249 | // BEFORE | ||
250 | fn foo() -> i32┃ { 42i32 } | ||
251 | |||
252 | // AFTER | ||
253 | fn foo() -> Result<i32, > { Ok(42i32) } | ||
254 | ``` | ||
255 | |||
244 | ## `change_visibility` | 256 | ## `change_visibility` |
245 | 257 | ||
246 | Adds or changes existing visibility specifier. | 258 | Adds or changes existing visibility specifier. |
diff --git a/docs/user/readme.adoc b/docs/user/readme.adoc index b1af72ce6..f6ce0accf 100644 --- a/docs/user/readme.adoc +++ b/docs/user/readme.adoc | |||
@@ -57,7 +57,11 @@ To disable this notification put the following to `settings.json` | |||
57 | ---- | 57 | ---- |
58 | ==== | 58 | ==== |
59 | 59 | ||
60 | The server binary is stored in `~/.config/Code/User/globalStorage/matklad.rust-analyzer` (Linux) or in `~/.Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer` (macOS) or in `%APPDATA%\Code\User\globalStorage` (Windows). | 60 | The server binary is stored in: |
61 | |||
62 | * Linux: `~/.config/Code/User/globalStorage/matklad.rust-analyzer` | ||
63 | * macOS: `~/Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer` | ||
64 | * Windows: `%APPDATA%\Code\User\globalStorage\matklad.rust-analyzer` | ||
61 | 65 | ||
62 | Note that we only support the latest version of VS Code. | 66 | Note that we only support the latest version of VS Code. |
63 | 67 | ||
@@ -135,17 +139,16 @@ If your editor can't find the binary even though the binary is on your `$PATH`, | |||
135 | 139 | ||
136 | ==== Arch Linux | 140 | ==== Arch Linux |
137 | 141 | ||
138 | The `rust-analyzer` binary can be installed from AUR (Arch User Repository): | 142 | The `rust-analyzer` binary can be installed from the repos or AUR (Arch User Repository): |
139 | 143 | ||
140 | - https://aur.archlinux.org/packages/rust-analyzer-bin[`rust-analyzer-bin`] (binary from GitHub releases) | 144 | - https://www.archlinux.org/packages/community/x86_64/rust-analyzer/[`rust-analyzer`] (built from latest tagged source) |
141 | - https://aur.archlinux.org/packages/rust-analyzer[`rust-analyzer`] (built from latest tagged source) | 145 | - https://aur.archlinux.org/packages/rust-analyzer-git[`rust-analyzer-git`] (latest Git version) |
142 | - https://aur.archlinux.org/packages/rust-analyzer-git[`rust-analyzer-git`] (latest git version) | ||
143 | 146 | ||
144 | Install it with AUR helper of your choice, for example: | 147 | Install it with pacman, for example: |
145 | 148 | ||
146 | [source,bash] | 149 | [source,bash] |
147 | ---- | 150 | ---- |
148 | $ yay -S rust-analyzer-bin | 151 | $ pacman -S rust-analyzer |
149 | ---- | 152 | ---- |
150 | 153 | ||
151 | === Emacs | 154 | === Emacs |
@@ -159,11 +162,11 @@ Emacs support is maintained as part of the https://github.com/emacs-lsp/lsp-mode | |||
159 | 3. Run `lsp` in a Rust buffer. | 162 | 3. Run `lsp` in a Rust buffer. |
160 | 4. (Optionally) bind commands like `lsp-rust-analyzer-join-lines`, `lsp-extend-selection` and `lsp-rust-analyzer-expand-macro` to keys. | 163 | 4. (Optionally) bind commands like `lsp-rust-analyzer-join-lines`, `lsp-extend-selection` and `lsp-rust-analyzer-expand-macro` to keys. |
161 | 164 | ||
162 | === Vim | 165 | === Vim/NeoVim |
163 | 166 | ||
164 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. | 167 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. Not needed if the extension can install/update it on its own, coc-rust-analyzer is one example. |
165 | 168 | ||
166 | The are several LSP client implementations for vim: | 169 | The are several LSP client implementations for vim or neovim: |
167 | 170 | ||
168 | ==== coc-rust-analyzer | 171 | ==== coc-rust-analyzer |
169 | 172 | ||
@@ -183,7 +186,7 @@ The are several LSP client implementations for vim: | |||
183 | 186 | ||
184 | 1. Install LanguageClient-neovim by following the instructions | 187 | 1. Install LanguageClient-neovim by following the instructions |
185 | https://github.com/autozimu/LanguageClient-neovim[here] | 188 | https://github.com/autozimu/LanguageClient-neovim[here] |
186 | * The github project wiki has extra tips on configuration | 189 | * The GitHub project wiki has extra tips on configuration |
187 | 190 | ||
188 | 2. Configure by adding this to your vim/neovim config file (replacing the existing Rust-specific line if it exists): | 191 | 2. Configure by adding this to your vim/neovim config file (replacing the existing Rust-specific line if it exists): |
189 | + | 192 | + |
@@ -216,17 +219,11 @@ let g:ycm_language_server = | |||
216 | 219 | ||
217 | ==== ALE | 220 | ==== ALE |
218 | 221 | ||
219 | To add the LSP server to https://github.com/dense-analysis/ale[ale]: | 222 | To use the LSP server in https://github.com/dense-analysis/ale[ale]: |
220 | 223 | ||
221 | [source,vim] | 224 | [source,vim] |
222 | ---- | 225 | ---- |
223 | call ale#linter#Define('rust', { | 226 | let g:ale_linters = {'rust': ['analyzer']} |
224 | \ 'name': 'rust-analyzer', | ||
225 | \ 'lsp': 'stdio', | ||
226 | \ 'executable': 'rust-analyzer', | ||
227 | \ 'command': '%e', | ||
228 | \ 'project_root': '.', | ||
229 | \}) | ||
230 | ---- | 227 | ---- |
231 | 228 | ||
232 | ==== nvim-lsp | 229 | ==== nvim-lsp |