-
Notifications
You must be signed in to change notification settings - Fork 160
Fix cross-file go-to-definition navigation in Pyrefly Sandbox - Issue #1061 #1070
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much!!
This change is great. Awesome test coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review automatically exported from Phabricator review in Meta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manual testing reveals a few issues:
- hovering the function and pressing cmd ends up performing the go-to def (this isn't the case on the prod sandbox so I wonder if it was introduced here?)
- navigating across files does not seem to end up on the correct line
would you be able to do more manual testing to ensure this feature works correctly? sorry I didn't catch these earlier, I am not too familiar with the sandbox
|
…definition line number in tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the delayed review!! I was at a conference and this dropped off my radar.
This is standard monaco editor behaviour I believe, did not code anything on my side, just that now the goto definition works hence so does the shortcut for it
VSCode has two apis: "get definition" and "go to definition". Get definition happens on cmd+hover in order to preview the location, but we only want to "go" on click. I imagine monaco is similar, and we have hooked into the "get" instead of the "go to". Do you think you could attempt this?
Let me check this, my current logic just lands you on the file where the definition is stored I believe. Its a bit short sighted but I was just assuming at that time people would be using small imports to check out a sandbox. I can refine this tho
I think it's necessary to bring them to the line/column if that would work. otherwise, finding the import is just as good since the user likely only has a few tabs open in the sandbox
I will have a look at the first one, second one is up and running |
Problem
Issue: #1061 Go-to-definition across files in the web editor was jumping to random locations in the current file
instead of navigating to the correct location in the target file.
Solution
Enhanced the go-to-definition system to return target file information:
goto_definition()
to returnDefinitionResult
struct with both range andtarget filename
using current file URI
Key Changes
playground.rs
: NewDefinitionResult
struct with filename fieldconfigured-monaco.ts
: Fixed definition provider to use target file URISandbox.tsx
: Added cross-file navigation supporttest_cross_file_goto_definition
for cross-file goto-definition functionalityTesting