-
Notifications
You must be signed in to change notification settings - Fork 194
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
Go to definition not working when using "relative to project root" import paths. #450
Comments
You need to prefix the imports with ./ for example ./src so they can be differentiated from libraries dependencies |
Thanks for the quick reply! Unfortunately what you suggest does not work, as Foundry error:
Foundry has no problem finding the files when imported as shown in my post above. Likewise, the nomic foundation extension can find the files just fine when using that pattern. I like this pattern because it means I can copy-paste the imports into any of my project files and they will work without change. Is there any way you could support such import paths? To me it looks like the extension should simply not add the leading |
Note that hover cards for the items imported like in my post above work fine, so the LSP can find those items indeed. Only the file that gets opened on "go to definition" has the wrong path, because a leading slash is added, turning them into absolute paths. |
Same issue here. |
Consider the following foundry project structure:
In FileA.sol, I use import paths relative to the root of the project:
When I use "go to definition" on those imported items, the file that gets opened is an absolute path:
/src/FileB.sol
or/test/Test.t.sol
which obviously do not exist at the root of my filesystem.The text was updated successfully, but these errors were encountered: