vscode-solidity: Contracts in NPM @org/dep scoped dependencies don't resolve

I have

{
    "solidity.packageDefaultDependenciesContractsDirectory": "",
    "solidity.packageDefaultDependenciesDirectory": "node_modules"
}

in my settings and am trying to import contracts from a scoped package, but am getting an error: Source "@org/dep/contracts/Dependency.sol" not found: File import callback not supported

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 1
  • Comments: 26 (16 by maintainers)

Most upvoted comments

I am getting an error with for import "merkle-trees/libraries/memory/bytes32/standard/merkle-library.sol";

where merkle-trees is in project_root/node_modules

with settings

"solidity.packageDefaultDependenciesContractsDirectory": "",
"solidity.packageDefaultDependenciesDirectory": "",

Obviously I don’t have these set correctly, but its quite unclear how to set these.

Any tips?

And your imports? you may need to remove the “contracts” from packageDefaultDependenciesContractsDirectory and use “” instead.

@cag I have tested this in Linux, Mac and Windows… and I have reproduced it, although eventually just changing the settings and restarting vscode has solved the issue.