mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Add RA_WAIT_DBG and docs
This commit is contained in:
parent
3f0e34e08e
commit
185cd736a6
3 changed files with 10 additions and 1 deletions
|
@ -57,6 +57,7 @@ FLAGS:
|
||||||
ENVIRONMENTAL VARIABLES:
|
ENVIRONMENTAL VARIABLES:
|
||||||
RA_LOG Set log filter in env_logger format
|
RA_LOG Set log filter in env_logger format
|
||||||
RA_PROFILE Enable hierarchical profiler
|
RA_PROFILE Enable hierarchical profiler
|
||||||
|
RA_WAIT_DBG If set acts like a --wait-dbg flag
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ fn main() {
|
||||||
|
|
||||||
fn try_main() -> Result<()> {
|
fn try_main() -> Result<()> {
|
||||||
let args = args::Args::parse()?;
|
let args = args::Args::parse()?;
|
||||||
if args.wait_dbg {
|
if args.wait_dbg || env::var("RA_WAIT_DBG").is_ok() {
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
let mut d = 4;
|
let mut d = 4;
|
||||||
while d == 4 {
|
while d == 4 {
|
||||||
|
|
|
@ -57,6 +57,14 @@ To apply changes to an already running debug process, press <kbd>Ctrl+Shift+P</k
|
||||||
|
|
||||||
- Go back to the `[Extension Development Host]` instance and hover over a Rust variable and your breakpoint should hit.
|
- Go back to the `[Extension Development Host]` instance and hover over a Rust variable and your breakpoint should hit.
|
||||||
|
|
||||||
|
If 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`)
|
||||||
|
```rust
|
||||||
|
let mut d = 4;
|
||||||
|
while d == 4 { // set a breakpoint here and change the value
|
||||||
|
d = 4;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
- [Debugging TypeScript VScode extension](https://www.youtube.com/watch?v=T-hvpK6s4wM).
|
- [Debugging TypeScript VScode extension](https://www.youtube.com/watch?v=T-hvpK6s4wM).
|
||||||
|
|
Loading…
Reference in a new issue