diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-08 11:49:00 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-08 11:49:00 +0100 |
commit | d43b3bfecbc0fe2ed37a93faf58906e08da6b9e8 (patch) | |
tree | 8fa2b2928560360596179efc9f15af1e63b7265a /docs/user | |
parent | a12f037e12fa79a8776a0509484846f30570c1ec (diff) | |
parent | ca0aef2f3f8785a18d0c52420ac9f33e9bbda55e (diff) |
Merge #8763
8763: feat: make troubleshooting a top-level section r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/manual.adoc | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index 8bd861b8a..a1d1951d0 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc | |||
@@ -137,41 +137,6 @@ If you're not using Code, you can compile and install only the LSP server: | |||
137 | $ cargo xtask install --server | 137 | $ cargo xtask install --server |
138 | ---- | 138 | ---- |
139 | 139 | ||
140 | ==== Troubleshooting | ||
141 | |||
142 | Start with looking at the rust-analyzer version. | ||
143 | Try **Rust Analyzer: Show RA Version** and `rust-analyzer --version` in the command line. | ||
144 | If the date is more than a week ago, it's better to update rust-analyzer version. | ||
145 | |||
146 | The next thing to check would be panic messages in rust-analyzer's log. | ||
147 | Log messages are printed to stderr, in VS Code you can see then in the `Output > Rust Analyzer Language Server` tab of the panel. | ||
148 | To see more logs, set `RA_LOG=info` environmental variable. | ||
149 | |||
150 | To fully capture LSP messages between the editor and the server, set `"rust-analyzer.trace.server": "verbose"` config and check | ||
151 | `Output > Rust Analyzer Language Server Trace`. | ||
152 | |||
153 | The root cause for many "`nothing works`" problems is that rust-analyzer fails to understand the project structure. | ||
154 | To debug that, first note the `rust-analyzer` section in the status bar. | ||
155 | If it has an error icon and red, that's the problem (hover will have somewhat helpful error message). | ||
156 | **Rust Analyzer: Status** prints dependency information for the current file. | ||
157 | Finally, `RA_LOG=project_model=debug` enables verbose logs during project loading. | ||
158 | |||
159 | If rust-analyzer outright crashes, try running `rust-analyzer analysis-stats /path/to/project/directory/` on the command line. | ||
160 | This command type checks the whole project in batch mode bypassing LSP machinery. | ||
161 | |||
162 | When filing issues, it is useful (but not necessary) to try to minimize examples. | ||
163 | An ideal bug reproduction looks like this: | ||
164 | |||
165 | ```bash | ||
166 | $ git clone https://github.com/username/repo.git && cd repo && git switch --detach commit-hash | ||
167 | $ rust-analyzer --version | ||
168 | rust-analyzer dd12184e4 2021-05-08 dev | ||
169 | $ rust-analyzer analysis-stats . | ||
170 | 💀 💀 💀 | ||
171 | ``` | ||
172 | |||
173 | It is especially useful when the `repo` doesn't use external crates or the standard library. | ||
174 | |||
175 | === rust-analyzer Language Server Binary | 140 | === rust-analyzer Language Server Binary |
176 | 141 | ||
177 | Other editors generally require the `rust-analyzer` binary to be in `$PATH`. | 142 | Other editors generally require the `rust-analyzer` binary to be in `$PATH`. |
@@ -434,6 +399,41 @@ With | |||
434 | ---- | 399 | ---- |
435 | Then click on apply, and restart the LSP server for your rust project. | 400 | Then click on apply, and restart the LSP server for your rust project. |
436 | 401 | ||
402 | == Troubleshooting | ||
403 | |||
404 | Start with looking at the rust-analyzer version. | ||
405 | Try **Rust Analyzer: Show RA Version** in VS Code and `rust-analyzer --version` in the command line. | ||
406 | If the date is more than a week ago, it's better to update rust-analyzer version. | ||
407 | |||
408 | The next thing to check would be panic messages in rust-analyzer's log. | ||
409 | Log messages are printed to stderr, in VS Code you can see then in the `Output > Rust Analyzer Language Server` tab of the panel. | ||
410 | To see more logs, set `RA_LOG=info` environmental variable. | ||
411 | |||
412 | To fully capture LSP messages between the editor and the server, set `"rust-analyzer.trace.server": "verbose"` config and check | ||
413 | `Output > Rust Analyzer Language Server Trace`. | ||
414 | |||
415 | The root cause for many "`nothing works`" problems is that rust-analyzer fails to understand the project structure. | ||
416 | To debug that, first note the `rust-analyzer` section in the status bar. | ||
417 | If it has an error icon and red, that's the problem (hover will have somewhat helpful error message). | ||
418 | **Rust Analyzer: Status** prints dependency information for the current file. | ||
419 | Finally, `RA_LOG=project_model=debug` enables verbose logs during project loading. | ||
420 | |||
421 | If rust-analyzer outright crashes, try running `rust-analyzer analysis-stats /path/to/project/directory/` on the command line. | ||
422 | This command type checks the whole project in batch mode bypassing LSP machinery. | ||
423 | |||
424 | When filing issues, it is useful (but not necessary) to try to minimize examples. | ||
425 | An ideal bug reproduction looks like this: | ||
426 | |||
427 | ```bash | ||
428 | $ git clone https://github.com/username/repo.git && cd repo && git switch --detach commit-hash | ||
429 | $ rust-analyzer --version | ||
430 | rust-analyzer dd12184e4 2021-05-08 dev | ||
431 | $ rust-analyzer analysis-stats . | ||
432 | 💀 💀 💀 | ||
433 | ``` | ||
434 | |||
435 | It is especially useful when the `repo` doesn't use external crates or the standard library. | ||
436 | |||
437 | == Configuration | 437 | == Configuration |
438 | 438 | ||
439 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs[config.rs] | 439 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs[config.rs] |