Skip to content
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

Find all References only list references in the current file and opened file #608

Open
MarcusBright opened this issue Oct 20, 2024 · 4 comments

Comments

@MarcusBright
Copy link

Is it possible that i can find all references across files in a project.

@kanej
Copy link
Member

kanej commented Oct 21, 2024

We would expect find all references to work across files, even if they were not open in the editor.
Is the repo open source?

@MarcusBright
Copy link
Author

here is a demo repo: https://github.com/smartcontractkit/ccip-starter-kit-foundry.
image
when i opened PingPongDemo.sol(node_modules/@chainlink/contracts-ccip/src/v0.8/ccip/applications/PingPongDemo.sol) and refind references, the reference in PingPongDemo.sol showed up.
image

@kanej
Copy link
Member

kanej commented Nov 12, 2024

Thanks, I was able to reproduce this using the demo repo. This is expected behavior.

We do not analyze node_modules for Solidity files directly. We scan the contracts folders (in this case ./src), then analyze each Solidity file in the folder and all its imported dependencies transitively. So PingPongDemo.sol is not part of the initial scan.
Once you open the PingPongDemo.sol file, it gets included in the analysis and hence the references then point to it.

@iFrostizz
Copy link

It is true that it may be a bit excessive to check for references in libraries, but currently the ones in a multi-project setup are not found either, same for definitions. Take for example the event called MessageReceived in this repo.
Add a src2/ directory next to the src/ project and inside of it, a file called Message.sol with the following content:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import {MessageReceived} from "src/BasicMessageReceiver.sol";

contract Message {
    function a() public {
        emit MessageReceived(bytes32(0), 0, address(0), "");
    }
}

The MessageReceived event definition cannot be fetched and is not present in the references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@kanej @iFrostizz @MarcusBright and others