-
Notifications
You must be signed in to change notification settings - Fork 194
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
Remappings example for brownie #288
Comments
Ah.. @PatrickAlphaC all the mappings are setup to be relative to the folder. I need to change that when prefixed by "/" or "C:", thanks for pointing that out. |
…ctoring common / server / client
@PatrickAlphaC check the latest release and let me know how it goes, added the absolute support. |
@juanfranblanco don't want to speak for Patrick, but I was running into this same issue and going insane trying to google it and figure out how to make this extension work better with brownie. finally came across this issue. the remappings setting you listed above worked for me and the infuriating "File import callback not supported" highlight has gone away. thank you very much. |
@Brodan thank you very much for confirming this. I wanted to validate it before updating the Readme. Note that you can also add now a remappings.txt at the root of your workspace file with each remapping included in a new line. |
I was being a dunce, got it :D Just needed to give ol-vscode a reboot after installing the update. Example: "solidity.remappings": [
"@chainlink/=/Users/patrick/.brownie/packages/smartcontractkit/[email protected]",
"@openzeppelin/=/Users/patrick/.brownie/packages/OpenZeppelin/[email protected]"
] Thank you so much for this!!! |
That is awesome @PatrickAlphaC thanks for confirming!! |
Hi @juanfranblanco, so found out another edge case though :( "solidity.remappings": [
"@openzeppelin/=/Users/patrick/.brownie/packages/OpenZeppelin/[email protected]",
"@openzeppelin/contracts-upgradeable/=/Users/patrick/.brownie/packages/OpenZeppelin/@openzeppelin/[email protected]"
] If I have 2 repos from the same org, the remappings settings file doesn't know how to handle this. Is this something we could fix too? |
Additionally.... it would be great to add home directory functionality, ie:
instead of absolute... Thanks again for taking a look! |
What is the actual error? I see that your remapping targets do not end with
I think that translating How does Brownie handle The real solution to this problem is to use relative paths as remapping targets. Absolute paths end up in your metadata and should be avoided in contracts in general. Unfortunately until recently the compiler did not have good support for this use case on the CLI (and Brownie uses the CLI). Relative targets were relative to base path (current work dir by default) which works for package managers like npm which install libs in a subdir of your project but not for Brownie which installs them under a fixed global path. solc 0.8.8 finally has the
|
There isn't an error, but if I try to do something like:
Only the So brownie stores imports in a special location at |
Maybe you're hitting this bug: eth-brownie/brownie#893? EDIT: Ah, sorry, the bug is in Brownie and your problem is in the extension so it's probably not it. |
@PatrickAlphaC let me check that, yes I can see the issue with matching the first element. Also. yes the extension does not translate ~, only works with absolute / relative. Note that there are two remappings, one for the compiler and one for the extension to find imports, autocomplete etc. |
Check the latest release, although the ~ path @cameel can you confirm that is ok? |
What |
@cameel oh I meant, if the |
Oh. No it's not supported directly by the compiler and I don't think it should be. Using absolute paths is something that should be discouraged (and relative paths should eventually get better support). You can use |
Ah thanks, then I won't do anything about that. And I totally understand, as it is not going to be very portable anyway with windows machines. |
Hi, is there any solution regarding this solidity.remappings path issue when developing on different platforms?
I also cannot use VS Code environment variables:
And as far as I know, VS Code does not support platform specific settings. |
Hey, that is an interesting thought! Having those env values. |
Do you have a node example to quickly test it? |
Hi Juan!
Thank you so much for the remapping addition, this is huge!
So for a brownie project, in my contracts I have something like:
And the package is located at:
I can't seem to get the settings write for
Source "@chainlink/contracts/src/v0.8/ChainlinkClient.sol" not found: File import callback not supported
to go away. Any thoughts?The following doesn't seem to be working:
The text was updated successfully, but these errors were encountered: