-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: go to definition from
use
statement (#5390)
# Description ## Problem Resolves #5389 ## Summary "Go to definition" works by scanning some `id_to_location` hash map where all expressions and statements locations are stored. However, "use" statement locations aren't captured there. Then, we recently implemented rename functionality which works by building a graph that connects references to referenced nodes. This same graph can be used for "go to definition"! So that's what this PR does. However, it will first check the graph, then try the other approach because I think that other approach works for trait impls and other things which aren't captured in the reference graph. I'm still trying to understand that part and to avoid breaking things I left it as is (there are also no tests for those things so it's hard to know if we break something... but I plan to add more tests in the future). https://github.com/noir-lang/noir/assets/209371/1dd2cb7e-7f41-4065-8761-4a0478937166 ## Additional Context None. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: Tom French <[email protected]>
- Loading branch information
1 parent
ee8b0cd
commit 53bae3b
Showing
10 changed files
with
239 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.