-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: go-to-def and find-references on control-flow keywords #17542
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.
One thing to look out for is the turning FileRange
into TextRange
after upmapping. All of those need to verify that the file id of the FileRange
is in fact the same as the file we are doing the feature stuff in, as include!
has its input in a different file than where the call is. Generally speaking, dropping the file id of a FileRange
yielded from upmapping without checks can easily cause issues
5e66fbd
to
4ffe9e5
Compare
f3db243
to
7d171bf
Compare
I squashed some commits related to @rustbot label -S-waiting-on-author +S-waiting-on-review |
☔ The latest upstream changes (presumably #17620) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r+ |
☀️ Test successful - checks-actions |
fix #17517.
This PR implements go-to-definition and find-references functionalities for control flow keywords, which is similar to the behaviors in the
highlight-related
module. Besides, this PR also fixes some incorrect behaviors inhighlight-related
.Changes
Support for go-to-definition on control flow keywords:
This PR introduces functionality allowing users to navigate on the definition of control flow keywords (
return
,break
,continue
).Commit: 2a3244e..7391e7a.
Bug fixes and refactoring in highlight-related:
This PR adjusted the behavior of these keywords when they occur within
try_blocks
. When encounter these keywords, the program should exit the outer function or loop which containing thetry_blocks
, rather than thetry_blocks
itself; while the?
will cause the program to exittry_blocks
.Commit: 59d697e.
Commit: 88df24f.
preorder_expr
incorrectly treatedtry_blocks
as new contexts, thereby r-a will not continue to traverse innerreturn
andbreak/continue
statements. To resolve this, a new functionpreorder_expr_with_ctx_checker
has been added, allowing users to specify which expressions to skip.?
in the context, r-a should skiptry_blocks
where the?
insides just works fortry_blocks
. But when search for thereturn
keyword, r-a should collect both thereturn
keywords inside and outside thetry_blocks
WalkExpandedExprCtx
(builder pattern). It offers the following improvements: customizable context skipping, maintenance of loop depth (forbreak
/continue
), and handling macro expansion during traversal.Support for find-references on control flow keywords:
This PR enables users to find all references to control flow keywords.
Commit: 9202a33.