-
Notifications
You must be signed in to change notification settings - Fork 44
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
Truffle support #393
Truffle support #393
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## development #393 +/- ##
==============================================
Coverage ? 54.28%
==============================================
Files ? 183
Lines ? 4681
Branches ? 767
==============================================
Hits ? 2541
Misses ? 1905
Partials ? 235 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
50dba43
to
80d9497
Compare
I have been running through the truffle getting started guide: https://trufflesuite.com/docs/truffle/quickstart/ After unboxing metacoin, I have a working project that I open with the extension: truffle unbox metacoin [PATH/TO/DIRECTORY] On opening the Specifically: |
@kanej the |
What do you think of suppressing an error on the import of |
I think it works. We can add more to that list if we discover there are other imports of this kind. |
I tried this and actually found out that it doesn't quite work. I tried 2 options: 1st, suppressing the error, and 2nd, injecting a source with empty content for DeployedAddresses.sol. In the first case, all validation is lost because solc doesn't return other errors if there are import errors present, and in the 2nd case, the import line is not erroring but the usages e.g. |
@antico5 is there an approach to resolving the truffle contracts under node modules as part of the truffle project? The particular problem I am thinking of is from a truffle solidity test, jumping into the assert sol file via |
return "Truffle"; | ||
} | ||
|
||
public async initialize(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we trigger a reinitialization on each config change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that logic is on the onWatchedFilesChanges
method of this class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a change to get to the comparison check on onWatchedFilesChanges
as the uri had file://
as a prefix.
Is there a better way of doing that comparison with inbuilt vscode functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use URI.parse(<uri>).fsPath
. The import is import { URI } from "vscode-uri";
We could easily associate files under node_modules to the truffle project, although that wouldn't work if truffle is being used as a global package. For the global package, I don't know how we could associate them with a single project, since many open projects could be using the global module. |
Lets take that approach. I think we can assume that a global install is less common and just deal with local |
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested on the latest getting started guide for truffle and we are providing a significantly improved experience.
We should hold off on merging until we have a release schedule (and consideration of docs)
0b72a0b
to
3b1a965
Compare
* feat: server document formatting provider * tests for server document formatting * truffle adapter scaffolding * wip import resolution * support node modules imports * truffle validation * read truffle config * reinitialize truffle project on config change * read globalNodeModulesPath only on initialization * change crawlDependencies to use Set for visited nodes * tests for truffle project * update TruffleProject#fileBelongs * add support for DeployedAddresses.sol * feat: base DeployedAddresses off of build dir * test: add failed initialization for truffle * fix: reinitialize on change to truffle config * claim contracts under node_modules on truffle project * use vscode-uri to get path from uri --------- Co-authored-by: John Kane <john@kanej.me>
* feat: server document formatting provider * tests for server document formatting * truffle adapter scaffolding * wip import resolution * support node modules imports * truffle validation * read truffle config * reinitialize truffle project on config change * read globalNodeModulesPath only on initialization * change crawlDependencies to use Set for visited nodes * tests for truffle project * update TruffleProject#fileBelongs * add support for DeployedAddresses.sol * feat: base DeployedAddresses off of build dir * test: add failed initialization for truffle * fix: reinitialize on change to truffle config * claim contracts under node_modules on truffle project * use vscode-uri to get path from uri --------- Co-authored-by: John Kane <john@kanej.me>
^0.8.0
Closes #45