-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Summary
This covers the implicit subpkg = mypackage.subpkg local assignment that from .subpkg.whatever import blah creates in an __init__.py.
In astral-sh/ruff#21793 I added several tests for this and marked the bad results as TODO(submodule-imports)
✅ goto-type and hover work great, because they're just asking the inference engine or correctly using the fact that hovering the LHS of import-from is always modules.
🆗 goto-declaration mostly works, there's one "hmm what SHOULD this do" case and one "oh I think we're just seeing broken handling of imports writ-large"
The span is overly broad. This is because the (fixed in astral-sh/ruff#21795)Definition actually claims the entire from..import.. AST node. Unfortunately even if we made it only claim the LHS Identifier it would still be overly broad (from .x.y would highlight x.y instead of just x). So either way the LSP probably wants to special-case the span here.
❌ find-references/rename doesn't really understand it at all.
Version
No response