So you have written your first Rust program that is more complicated than Hello World, you are using Visual Studio Code (of course you are because it is awesome!), and you want to debug it in the IDE. Well here is what to do:
Enter the Debug Tab and click “Add Configuration”, from the drop down next to the green play button. Select LLDB - Customer Launch. You should end up with a launch.json file in your workspace.
Open this file and copy the text below:
{
”version”: ”0.2.0”,
”configurations”: [
{
”name”: ”(Linux) Launch”,
”type”: ”lldb”,
”request”: ”launch”,
”program”: ”${workspaceRoot}/target/debug/binary_search”,
”args”: [],
”cwd”: ”${workspaceRoot}”,
}
]
}
Change ‘binary_search’ to the name of your executable
You should end up with something like this:
And that is it!
You can find this project here with the vscode settings: https://github.com/johnward/algorithms_in_rust/tree/master/search_and_sorting/binary_search
Insert a breakpoint using F9 and, press F5 to debug! Have fun!