I’m using Visual Code a lot for Rust development, so it’d be good to be able to debug a Rust application within it. Simply change the settings.json file, i.e.
File | Preferences | Settings
from the settings.json and now add
"debug.allowBreakpointsEverywhere": true,
Now add the C/C++ Microsoft extension if you’ve not already added it to Visual Code.
Next up, select
Debug | Add Configuration...
and the option
C++ (Windows)
Here’s my resultant launch.json file
{ "version": "0.2.0", "configurations": [ { "name": "(Windows) Launch", "type": "cppvsdbg", "request": "launch", "program": "${workspaceFolder}/target/debug/test.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false } ] }
and that’s it, now add a break point to your application, select Debug | Start Debugging (F5) and you’re off and running in the debugger.