Unnamed repository; edit this file 'description' to name the repository.
>

Common knowledge

Debug TypeScript VSCode extension

TypeScript debugging is configured to watch your source edits and recompile. To apply changes to an already running debug process, press Ctrl+Shift+P and run the following command in your [Extension Development Host]

> Developer: Reload Window

Debug Rust LSP server

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

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)

    let mut d = 4;
    while d == 4 { // set a breakpoint here and change the value
        d = 4;
    }

However for this to work, you will need to enable debug_assertions in your build

RUSTFLAGS='--cfg debug_assertions' cargo build --release

Demo

Troubleshooting

Can't find the rust-analyzer process

It could be a case of just jumping the gun.

The rust-analyzer is only started once the onLanguage:rust activation.

Make sure you open a rust file in the [Extension Development Host] and try again.

Can't connect to rust-analyzer

Make sure you have run echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope.

By default this should reset back to 1 every time you log in.

Breakpoints are never being hit

Check your version of lldb. If it's version 6 and lower, use the classic adapter type. It's lldb.adapterType in settings file.

If you're running lldb version 7, change the lldb adapter type to bundled or native.