hardhat-vscode
hardhat-vscode copied to clipboard
[Foundry support] Dependencies resolution
This is feedback: https://github.com/nomiclabs/hardhat-vscode-feedback/issues/8
Currently, we only resolve dependencies based on Hardhat's project structure, which means resolving external dependencies using resolve with the project's root as basedir.
We need to detect when a project is using Foundry and resolve dependencies following their resolution logic.
I would love to use this extension but our project is a hybrid hardhat & foundry setup where the tests rely heavily on remappings. It would be wonderful if remappings could be derived directly from foundry.toml (recursively just like the forge remappings command resolves them) which would be even more powerful than the support for remappings.txt in the other solidty vscode extension that still requires you to produce a remappings.txt from the foundry.toml declarations to make it work.
I would just maybe note that remappings.txt is not necessarily built from foundry.toml, but rather can stand on its own. The documentation at https://book.getfoundry.sh/reference/config/solidity-compiler does not make it clear which takes precendence if the same remapping exists in both places; and foundry.toml can also appear in your home directory. The contents are namespaced and the namespace is selectable via the environment variable FOUNDRY_PROFILE. See https://book.getfoundry.sh/config/?highlight=foundry.toml#configuring-with-foundrytoml.
For these reasons it may be easiest to support only a remappings.txt file, particularly since the behavior of the editor would otherwise have to depend on environment variables passed somehow to the vscode remote execution host or by configuring the extension's settings anyway?
There is now experimental support for foundry projects and their deps resolution in the extension.