Support for truffle v5
Truffle v5 allows you to bring your own compiler, but this extension doesn't seem to be aware of that.
Source files requires different compiler version
Whereas my truffle-config.js file specifies a version which is compatible with the current smart contract code (compiling with truffle works fine):
compilers: {
solc: {
version: '0.4.24',
...
},
}
Hi @PaulRBerg,
You will need to use the vscode extension configuration to match the truffle compiler. Check the readme for that.
Edit.. (For the time being). I guess it could be added as a configuration option to put "truffle" and truffle file.
What I'm doing now is to have this in my "Workspace Settings":
{
"solidity.compileUsingRemoteVersion": "v0.4.24+commit.e67f0147"
}
But indeed, my suggestion was to have the vscode extension automatically detect the use of truffle.
I guess the remote version could be set as "truffle-version", this way the order of preference local, node-modules, etc will be preserved.
"solidity.compileUsingRemoteVersion": "truffle-version"
Also something that can be set only for the workspace.
In the meantime, are there any known workarounds like aliasing or symlinking the "truffle" folder?
Copied From: https://ethereum.stackexchange.com/questions/39213/smart-way-to-link-to-truffle-library-files-using-visual-code-on-ubuntu-14-04?rq=1
> ...
> pragma solidity ^0.4.18;
> import "truffle/Assert.sol"; // This import statement shows an error.
Below is the path to my current Truffle installation under NVM (Node Version Manager's) control:
> ~/.nvm/versions/node/v6.7.0/lib/node_modules/truffle/build/Assert.solMy question is, what is the smart way to tell Visual Code where to find the library files so that if I change > Node or Truffle versions, I don't break my smart contract projects? Symlink? Something else?
Related: https://github.com/juanfranblanco/vscode-solidity/issues/76 https://github.com/truffle-box/pet-shop-box/issues/32 https://github.com/trufflesuite/truffle/issues/787 https://github.com/trufflesuite/truffle/issues/968 https://github.com/trufflesuite/truffle/issues/756