Tags:
Two of the best features when using an IDE are auto completing and debugging. Fortunately, we can have both with VSCode.
Go to rust website and follow the install procedure
Then use nightly channel to get the latest version of the toolchain.
# Install nightly toolchain
$ rustup toolchain install nightly
# Set nightly toolchain as default
$ rustup default nightly
Install those 2 extensions:
After installing, open a rust file in the editor and you will be asked:
Some rust components not installed. Install it?
Click Yes
This is how auto complete looks:
And now with documentation
First: Create a launch.json using lldb
Press Ctrl + Shift + P
and select Debug: Open launch.json
Paste this content and replace hello with the name of your project
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Launch",
"args": [],
"program": "${workspaceFolder}/target/debug/hello",
"windows": {
"program": "${workspaceFolder}/target/debug/hello.exe"
},
"cwd": "${workspaceFolder}",
"stopOnEntry": false,
"sourceLanguages": [
"rust"
]
}
]
}
Now, you have to build and run with lldb debugger attached.
This is the debugger inspecting the content of the variable
That's all. Quite simple, with a bit of tweaking.