aboutsummaryrefslogtreecommitdiff
path: root/DEBUGGING.md
diff options
context:
space:
mode:
authorAndrew Ross <[email protected]>2019-01-18 10:59:08 +0000
committerAleksey Kladov <[email protected]>2019-01-19 12:36:54 +0000
commit1800bfb6e67ab7187f0fa51ca8241e904922ecd8 (patch)
tree50b642b7cd89beca48a622b4380ebd183da9e462 /DEBUGGING.md
parent168c46ab777f6e3263bb2e58f0ce9b0b1619114e (diff)
Config for raLspServerPath will be overwritten if __RA_LSP_SERVER_DEBUG is set
Changed presentation from clear to reveal silent Removed the vscode gitignore entry Added debugging documentation Added tasks and launch configs
Diffstat (limited to 'DEBUGGING.md')
-rw-r--r--DEBUGGING.md62
1 files changed, 62 insertions, 0 deletions
diff --git a/DEBUGGING.md b/DEBUGGING.md
new file mode 100644
index 000000000..0fa8ae29c
--- /dev/null
+++ b/DEBUGGING.md
@@ -0,0 +1,62 @@
1# Debugging vs Code plugin and the Language Server
2
3Install [LLDB](https://lldb.llvm.org/) and the [LLDB Extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb).
4
5Checkout rust rust-analyzer and open it in vscode.
6
7```
8$ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1
9$ cd rust-analyzer
10$ code .
11```
12
13- To attach to the `lsp server` in linux you'll have to run:
14
15 `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`
16
17 This enables ptrace on non forked processes
18
19- Ensure the dependencies for the extension are installed, run the `npm: install - editors/code` task in vscode.
20
21- Launch the `Debug Extension`, this will build the extension and the `lsp server`.
22
23- A new instance of vscode with `[Extension Development Host]` in the title.
24
25 Don't worry about disabling `rls` all other extensions will be disabled but this one.
26
27- In the new vscode instance open a rust project, and navigate to a rust file
28
29- In the original vscode start an additional debug session (the three periods in the launch) and select `Debug Lsp Server`.
30
31- A list of running processes should appear select the `ra_lsp_server` from this repo.
32
33- Navigate to `crates/ra_lsp_server/src/main_loop.rs` and add a breakpoint to the `on_task` function.
34
35- Go back to the `[Extension Development Host]` instance and hover over a rust variable and your breakpoint should hit.
36
37## Demo
38
39![demonstration of debugging](./images/Rls_Debug.gif)
40
41## Troubleshooting
42
43### Can't find the `ra_lsp_server` process
44
45It could be a case of just jumping the gun.
46
47The `ra_lsp_server` is only started once the `onLanguage:rust` activation.
48
49Make sure you open a rust file in the `[Extension Development Host]` and try again.
50
51### Can't connect to `ra_lsp_server`
52
53Make sure you have run `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`.
54
55By default this should reset back to 1 everytime you log in.
56
57### Breakpoints are never being hit
58
59Check your version of `lldb` if it's version 6 and lower use the `classic` adapter type.
60It's `lldb.adapterType` in settings file.
61
62If you're running `lldb` version 7 change the lldb adapter type to `bundled` or `native`.