Closed letmejustputthishere closed 4 months ago
Here is a workaround which we use in the base library (source code):
actor class Main() {
let Management = (actor "aaaaa-aa" : actor {
raw_rand : () -> async Blob;
});
public func greet(name : Text) : async Text {
ignore await Management.raw_rand();
return "Hello, " # name # "!";
};
};
I'll see if there's any way we can solve this within the VS Code extension; otherwise it might be necessary to fix this in dfx or the Motoko compiler.
Update: it sounds as though there are already plans to address this on the replica end. I'll keep an eye on this in case anything else is needed from the extension.
thanks for the workaround. another way of solving this without having to rewrite the management canister interface is to simply copy the aaaaa-aa.did
to .dfx/local/lsp
Some projects just check in the IC.mo
file like this: https://github.com/sonicdex/motoko-token-canister/blob/main/src/token/Cap.mo#L9
yes, but then i have to generate the motoko bindings from the did file which adds friction
The extension now uses a default management canister Candid file as of v0.15.0. This should resolve the issue; otherwise, let me know and I'll take another look.
hey @rvanasa, i see your hardcoding the management canister did. is there a way to include it via git submodules or smth similar? i just recently opened a PR there to make working with it a bit more convenient
Thanks for the link! I set up a script to regenerate the Candid file from this URL before packaging the extension (#265).
this canister builds, and
.dfx/local/canisters/idl/aaaaa-aa.did
is being generated.the vscode extension wants the did in a different path though
file "/Users/moritz/projects/icrc7_launchpad/.dfx/local/lsp/aaaaa-aa.did" does not existMotoko(M0009)
dfx 0.16.0
motoko extension v0.14.8