Open milosdjurica opened 10 months ago
Same issue here, running on windows too. Everything works fine except this annoying error message when opening vscode.
The correct path is "%USERPROFILE%\\.foundry\\bin\\forge"
, instead of "%USERPROFILE%\\.cargo\\bin\\forge"
.
The problematic part is here: server/src/frameworks/Foundry/resolveForgeCommand.ts
export async function resolveForgeCommand() {
if (resolvedForgeCommand) {
return resolvedForgeCommand;
}
const potentialForgeCommands = ["forge"];
if (runningOnWindows()) {
potentialForgeCommands.push(
`${process.env.USERPROFILE}\\.cargo\\bin\\forge`
);
} else {
potentialForgeCommands.push(
`${process.env.XDG_CONFIG_HOME || process.env.HOME}/.foundry/bin/forge`
);
}
There is a fix suggested in this PR: https://github.com/NomicFoundation/hardhat-vscode/pull/515
Problem: When attempting to open a Foundry project in VSCode using the Nomic Foundation Solidity extension, I encounter the following error:
I installed Foundry on Windows using Git Bash with the command:
And I ran
foundryup
after installation.When I run
where forge
in terminal, I get this path: "C:\Users\USERNAME.foundry\bin\forge.exe."I investigated further and found this commit: https://github.com/NomicFoundation/hardhat-vscode/pull/378/commits/90102debe1455a81551003aa716a6dd4ecedc521#diff-bb3d24c14df5446295dea3e272f667fcf3b9cd17ca7eb49863750e526c78ed67
In the file: server/src/frameworks/Foundry/FoundryProject.ts starting from line 223 there is this piece of code:
So I figured out that this path is probably hardcoded everywhere and this might be why I am encountering this issue.
When I switch to the Juan Blanco Solidity extension, I don't have this problem, so that is why I think this is problem with extension and not with my installation. It is worth mentioning that all my commands (until now) work correctly, and I have no problem with that, it is just this annoying error that I get when I open Foundry project.