Integrating with VSCode
You can get Solidity support for Visual Studio Code by installing the VSCode Solidity extension.
To make the extension play nice with Foundry, you will need to place your remappings in remappings.txt
. If they are already in foundry.toml
, copy them over and use remappings.txt
instead. If you just use the autogenerated remappings that Foundry provides, run forge remappings > remappings.txt
.
If you use a non-standard project layout, you may have to add the following to your .vscode/settings.json
:
{
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib"
}
Where src
is the source code directory and lib
is your dependency directory.
It is also recommended to specify a Solidity compiler version:
"solidity.compileUsingRemoteVersion": "v0.8.10"
To get Foundry in line with the chosen version, add the following to your default
profile in foundry.toml
.
solc_version = "0.8.10"