aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
484 stars 96 forks source link

aiken lsp code action suggests import "Script" from aiken/crypto and not cardano/address. #1042

Open waalge opened 1 month ago

waalge commented 1 month ago

What Git revision are you using?

aiken v1.1.4+79d0e45

What operating system are you using, and which version?

nixos

Describe what the problem is?

aiken lsp code action suggests import "Script" from aiken/crypto and not cardano/address.

If you blindly follow what the code suggestion is, then your at a complete loss as to where you went wrong.

What should be the expected behavior?

LSP be less clever when there is ambiguity on imports/ or LSP give options / or LSP be even cleverer and only ever choose the right one.

waalge commented 3 days ago

This seems to be fixed in 1.1.7. The lsp is distinguishing between the type and the constructor prompting to import the correct one

waalge commented 1 day ago

A little unclear why/ what factors are effecting this behaviour.

I previously could not reproduce with Script, as noted above.

But I now have the same error with VerificationKey:

   address == Address(VerificationKey(blake2b_224(return_key)), None),

To which the code action is

   Add new import line: use aiken/crypto.{VerificationKey}

Update : And I have now repeated the behaviour with Script : the only code action is use aiken/crypto. No clue as to what the difference was between now and the previous time when it seemed to work fine.