aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/bin/args.rs1
-rw-r--r--crates/rust-analyzer/src/bin/main.rs2
-rw-r--r--docs/dev/debugging.md8
3 files changed, 10 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/bin/args.rs b/crates/rust-analyzer/src/bin/args.rs
index abc00d03b..c5f814021 100644
--- a/crates/rust-analyzer/src/bin/args.rs
+++ b/crates/rust-analyzer/src/bin/args.rs
@@ -57,6 +57,7 @@ FLAGS:
57ENVIRONMENTAL VARIABLES: 57ENVIRONMENTAL VARIABLES:
58 RA_LOG Set log filter in env_logger format 58 RA_LOG Set log filter in env_logger format
59 RA_PROFILE Enable hierarchical profiler 59 RA_PROFILE Enable hierarchical profiler
60 RA_WAIT_DBG If set acts like a --wait-dbg flag
60 61
61COMMANDS: 62COMMANDS:
62 63
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index 0cddfecb5..80637cbff 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -29,7 +29,7 @@ fn main() {
29 29
30fn try_main() -> Result<()> { 30fn try_main() -> Result<()> {
31 let args = args::Args::parse()?; 31 let args = args::Args::parse()?;
32 if args.wait_dbg { 32 if args.wait_dbg || env::var("RA_WAIT_DBG").is_ok() {
33 #[allow(unused_mut)] 33 #[allow(unused_mut)]
34 let mut d = 4; 34 let mut d = 4;
35 while d == 4 { 35 while d == 4 {
diff --git a/docs/dev/debugging.md b/docs/dev/debugging.md
index 8c48fd5a1..cc7a790ff 100644
--- a/docs/dev/debugging.md
+++ b/docs/dev/debugging.md
@@ -57,6 +57,14 @@ To apply changes to an already running debug process, press <kbd>Ctrl+Shift+P</k
57 57
58- Go back to the `[Extension Development Host]` instance and hover over a Rust variable and your breakpoint should hit. 58- Go back to the `[Extension Development Host]` instance and hover over a Rust variable and your breakpoint should hit.
59 59
60If you need to debug the server from the very beginning, including its initialization code, you can use the `--wait-dbg` command line argument or `RA_WAIT_DBG` environment variable. The server will spin at the beginning of the `try_main` function (see `crates\rust-analyzer\src\bin\main.rs`)
61```rust
62 let mut d = 4;
63 while d == 4 { // set a breakpoint here and change the value
64 d = 4;
65 }
66```
67
60## Demo 68## Demo
61 69
62- [Debugging TypeScript VScode extension](https://www.youtube.com/watch?v=T-hvpK6s4wM). 70- [Debugging TypeScript VScode extension](https://www.youtube.com/watch?v=T-hvpK6s4wM).