[LS] String import resolution does not work with aliases
Closed this issue · 0 comments
jribbink commented
Current Behavior
Currently, string imports are resolved only from the deployments
section of flow.json
, however, are not resolved from aliased cotrats. This means that when checking contracts, particularly with pre-deployed/core contracts, imports may not resolve properly.
Expected Behavior
The LS should recognize contracts deployed contracts outside of the deployments
section as well (aliases). This probably means simply resolving anything from the contracts
section of flow.json
regardless of whether they appear in deployments
or not.
Steps To Reproduce
Try to use this project in VSCode with Cadence extension.
contracts/foo/Foo.cdc
import "NonFungibleToken"
pub contract Foo {}
flow.json
{
"contracts": {
"Foo": "cadence/contracts/foo/Foo.cdc",
"NonFungibleToken": {
"source": "cadence/contracts/standard/NonFungibleToken.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7"
}
}
},
"networks": {
"emulator": "127.0.0.1:3569",
"mainnet": "access.mainnet.nodes.onflow.org:9000",
"sandboxnet": "access.sandboxnet.nodes.onflow.org:9000",
"testnet": "access.devnet.nodes.onflow.org:9000"
},
"accounts": {
"default": {
"address": "ff8975b2fe6fb6f1",
"key": "4656ee827102b8b4f5c34b4b29afad3d75f61284f52e9b9573cade37b1b7bda4"
},
"emulator-account": {
"address": "f8d6e0586b0a20c7",
"key": "4656ee827102b8b4f5c34b4b29afad3d75f61284f52e9b9573cade37b1b7bda4"
},
"foo": {
"address": "e9dd1081676bbc90",
"key": "4656ee827102b8b4f5c34b4b29afad3d75f61284f52e9b9573cade37b1b7bda4"
},
"standard": {
"address": "0dbaa95c7691bc4f",
"key": "4656ee827102b8b4f5c34b4b29afad3d75f61284f52e9b9573cade37b1b7bda4"
}
},
"deployments": {
"emulator": {
"default": [],
"foo": [
"Foo"
],
"standard": []
}
}
}
You will see this error
![Screenshot 2023-10-19 at 3 04 39 PM](https://private-user-images.githubusercontent.com/17958158/276765763-525512a8-2357-4a35-8549-cce002c9ecbc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MjE0NDIsIm5iZiI6MTcyMTQyMTE0MiwicGF0aCI6Ii8xNzk1ODE1OC8yNzY3NjU3NjMtNTI1NTEyYTgtMjM1Ny00YTM1LTg1NDktY2NlMDAyYzllY2JjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE5VDIwMzIyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwNWEyMDk3OTA3YWIyNjZjN2E5MWNjOTNkMzdhYjEyNDlmMjE1Mzc3NmUzNDdhNjQ2MzBmY2FiZjBhYjFkZDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rQfUluwusSyU4SYHHmaau-sQZYjVrCze3LoCqX6cXSs)
Environment
- LS Version: v0.32.0
- Network: Emulator