Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source "@openzeppelin/..." not found: File not found. solidity(6275) #511

Closed
AuroraLantean opened this issue Aug 1, 2023 · 1 comment
Closed

Comments

@AuroraLantean
Copy link

AuroraLantean commented Aug 1, 2023

I am using Solidity v0.7.3 by Nomic Foundation in two Foundry repositories, and both have the same file structure, foundry.toml, installed forge dependencies, and remappings.txt

The difference between those two repos are file numbers in src and test folders.
In the smaller repo, I have one Solidity file importing dependencies from openzeppelin and aave. And the plugin in VS Code shows no problem.

in the bigger repo, after adding lots of files into src and test folders, the plugin showed no problem yesterday.
BUT today when I opened up VS Code, this plugin started to show this error:
Source "forge-std/console.sol" not found: File not found. Searched the following locations: "".solidity(6275)
Source "@openzeppelin/contracts/..." not found: File not found. Searched the following locations: "".solidity(6275)

Another difference is in the cache/solidity-files-cache.json
The bigger repo has "sources": "abc", BUT the smaller repo has "sources": "src"
Here is the first few lines from the bigger repo's solidity-files-cache.json:

{
  "_format": "ethers-rs-sol-cache-3",
  "paths": {
    "artifacts": "out",
    "build_infos": "out/build-info",
    "sources": "abc",
    "tests": "test",
    "scripts": "script",
    "libraries": [
      "lib"
    ]
  },

forge build and forge test ... all work fine in both repos. So the problem is not in file structure, foundry.toml, installed forge dependencies, or remappings.txt. I think somehow the plugin could not see remappings.txt... please help. Thanks

@AuroraLantean
Copy link
Author

Solved: https://book.getfoundry.sh/config/vscode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

1 participant