Install Lamington, VSCode, and Homebrew.
VSCode can natively compile C++, and can also help you by debugging your tests. This gives you red squiggles whenever there's a problem, and lets you poke at your data as your tests run. The end result of this guide doesn't fully understand all of the EOS specific syntax, but it's a lot better than working outside of an IDE.
Unfortunately we do not yet know of a good way to expose the CDT that's installed inside the Docker container to the main machine, but if you know a good way to do this, we're all ears! Please contact us on Slack!
To install the CDT on your machine so VSCode can see it, we can use Homebrew.
$ brew tap eosio/eosio.cdt
$ brew install eosio.cdt
So that VSCode can understand our C++, we'll need to install the C++ plugin from Microsoft.
Once all of that's done, you now have the header files you need for VSCode to understand your contracts. Configure VSCode by editing your settings.json file, either in the workspace or for your user account depending on whether you'd rather keep these settings to tell it where to find the CDT:
{
"C_Cpp.default.includePath": [
"/usr/local/eosio.cdt/include",
"/usr/local/Cellar/eosio.cdt/1.6.1/opt/eosio.cdt/include"
],
}
Lamington does not yet support debugging of the C++ code, but you can debug your Javascript/Typescript tests using VSCode. This allows you to use the inspector and see or manipulate the values of your tables at any step in your tests.
Edit (or creacte) the launch.json file in the .vscode directory to have a configuration like so:
{
"version": "0.2.0",
"configurations": [
{
"name": "Lamington Test",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": ["test"],
"timeout": 60000
}
]
}
This configuration will run npm test for you and allow you to step through breakpoints in your JS/TS tests.
Know a fix for any of the above issues? Contact us on Slack and let us know, or send a PR for this page so we can make it better!
Your environment is now set up for VSCode. C++ files should autocomplete for you, and you can step through your tests with the integrated debugger. Enjoy!