NomicFoundation / hardhat-vscode-feedback

A repository to collect feedback about Hardhat VSCode during its beta program
4 stars 1 forks source link

Can't go to definition of types originated from a library #17

Open UncleGrandpa925 opened 2 years ago

UncleGrandpa925 commented 2 years ago

Not sure if this is the intended behaviour (at this version) or not, but I will just put it here since I think it's a necessary feature.

For example, with the following statement, It's not possible to go to the TokenQtys definition.

MathLib.TokenQtys memory tokenQtys = MathLib.calculateAddLiquidityQuantities(
            _baseTokenQtyDesired,
            _quoteTokenQtyDesired,
            _baseTokenQtyMin,
            _quoteTokenQtyMin,
            IERC20(baseToken).balanceOf(address(this)),
            IERC20(quoteToken).balanceOf(address(this)),
            this.totalSupply(),
            intBalances
        );

As a result, it's also not possible to do variable renaming on the struct's members.

Steps to reproduce: Using this https://github.com/code-423n4/2022-01-elasticswap & navigate to Exchange.sol & try going to the definition of tokensQtys.

Environment: VSCode Version: 1.63.2 (Universal) on macOS & Hardhat VSCode version v0.0.21

kanej commented 2 years ago

@UncleGrandpa925 just to confirm the particular issue is with navigation from the type usage to its underlying declaration: image

I am able to reproduce a failed navigation if that is the case.

UncleGrandpa925 commented 2 years ago

Yes I'm referring to the type!

kanej commented 2 years ago

To give an update, this is a bug we can reproduce (thanks for the reproduction steps @UncleGrandpa925).

Our understanding is that we aren't getting enough information from our parser to deal with the nested type, the solution is likely to enhance solidity-parser with the extra info and then fix the navigation.

I'll update this ticket when we tackle the solidity-parser work.