juanfranblanco / vscode-solidity

Visual Studio Code language support extension for Solidity smart contracts in Ethereum https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
MIT License
871 stars 187 forks source link

cmd + click not working with project contract imports #414

Open gabkov opened 10 months ago

gabkov commented 10 months ago

Hi,

I have a foundry + hardhat project. When i try to open an another contract (with cmd + click) what i imported into my current contract from the project structure it breaks. I noticed that it puts an extra "/" before the file path. Also no suggestions come up when i try to use the imported contract.

This is my import:

image

And this is how it tries to open it, notice the extra '/' at the beginning on the left one(left is what the cmd + click opens the right is the correct file).

image

my settings.json:

{
    "solidity.compileUsingRemoteVersion": "v0.7.6+commit.7338295f",

    "solidity.monoRepoSupport": false,

    "solidity.enabledAsYouTypeCompilationErrorCheck": true,
    "solidity.validationDelay": 1500,
    "solidity.formatter": "forge",
    "solidity.packageDefaultDependenciesContractsDirectory": "contracts"
}

I tried with and without packageDefaultDependenciesContractsDirectory

any suggestions? thank you in advance.

bolabola commented 9 months ago

try "solidity.monoRepoSupport": false

gabkov commented 9 months ago

@bolabola i provided my setting.json. I tried it as you can see.

bolabola commented 9 months ago

here is my setting.json and remapings.txt

{ "[solidity]": { "editor.defaultFormatter": "JuanBlanco.solidity" }, "[toml]": { "editor.defaultFormatter": "tamasfe.even-better-toml" }, "npm.exclude": "**/lib/**", "solidity.formatter": "forge", "solidity.packageDefaultDependenciesContractsDirectory": "src", "solidity.packageDefaultDependenciesDirectory": "lib", "solidity.monoRepoSupport": false, "editor.formatOnSave": true }

remmaping.txt

ds-test/=lib/forge-std/lib/ds-test/src/ forge-std/=lib/forge-std/src/ @prb/test/=lib/prb-test/src/ @openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/

***.sol

import { IERC20 } from "@openzeppelin-contracts/token/ERC20/IERC20.sol";

it works well.