Skip to content
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
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Mar 21, 2025

Summary

Implement Goto type definition support for Red Knot's LSP.

TODOs:

Known limitations

  • Types defined in the vendored typeshed aren't supported because the client can't open those files (we can either implement our own file protocol and handler OR extract the typeshed files and point there)
  • Some nodes and types aren't supported yet. I added inline TODOs explaining what's missing
  • We may want to have a higher level API for the LSP that doesn't call semantic queries directly. I intentionally decided not to design that API just yet.

if new_contents != old_contents {
active_index = LineIndex::from_source_text(&new_contents);
}
active_index = LineIndex::from_source_text(&new_contents);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bugfix that I copied over from ruff-server

Copy link
Contributor

github-actions bot commented Mar 21, 2025

mypy_primer results

No ecosystem changes detected ✅

@MichaReiser MichaReiser force-pushed the micha/go-to-type-definition branch from f66cabc to 9b7cbc7 Compare March 21, 2025 16:43
@MichaReiser MichaReiser added the red-knot Multi-file analysis & type inference label Mar 21, 2025
Copy link
Contributor

github-actions bot commented Mar 21, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser force-pushed the micha/go-to-type-definition branch from 9b7cbc7 to e42a8da Compare March 21, 2025 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant