-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[red-knot] Goto type definition #16901
Draft
MichaReiser
wants to merge
6
commits into
micha/knot-ide
Choose a base branch
from
micha/go-to-type-definition
base: micha/knot-ide
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
MichaReiser
commented
Mar 21, 2025
if new_contents != old_contents { | ||
active_index = LineIndex::from_source_text(&new_contents); | ||
} | ||
active_index = LineIndex::from_source_text(&new_contents); |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
|
f66cabc
to
9b7cbc7
Compare
|
e42a8da
to
6b8b185
Compare
MichaReiser
added a commit
that referenced
this pull request
Mar 28, 2025
## Summary This PR adds `as_<group>` methods to `AnyNodeRef` to e.g. convert an `AnyNodeRef` to an `ExprRef`. I need this for go to definition where the fallback is to test if `AnyNodeRef` is an expression and then call `inferred_type` (listing this mapping at every call site where we need to convert `AnyNodeRef` to an `ExprRef` is a bit painful ;)) Split out from #16901 ## Test Plan `cargo test`
6b8b185
to
1d6dc13
Compare
1d6dc13
to
886e017
Compare
886e017
to
0ee9fd8
Compare
bfd6a9b
to
0a07abb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implement Goto type definition support for Red Knot's LSP.
TODOs:
(
returns no results because it then finds theArguments
node instead of the object identifier. We likely need a tie-breaker function. r-a uses aTokenAtOffset
enum that returnsNone
,Single
orBetween
and then prioritizesBetween
. https://github.com/rust-analyzer/rowan/blob/e73210820dcd990b1b028d524efacbd619144fc3/src/api.rs#L213-L216Known limitations