impl Completions: Auto import submodules. #2207#2311
impl Completions: Auto import submodules. #2207#2311asukaminato0721 wants to merge 5 commits intofacebook:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements auto-import suggestions for submodules as part of issue #2207. When a user types a submodule name that's not imported, the IDE will now suggest adding from <parent_module> import <submodule> imports, both in completions and as quick-fix code actions.
Changes:
- Added auto-import completion support for submodules that generates
from parent import submodulestyle imports - Added corresponding code action (quick-fix) suggestions for importing submodules
- Added comprehensive test coverage with new test fixtures and test case
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pyrefly/lib/test/lsp/lsp_interaction/test_files/autoimport_submodule/pyrefly.toml | Test configuration file defining search path |
| pyrefly/lib/test/lsp/lsp_interaction/test_files/autoimport_submodule/foo.py | Test file with copyright header (content added dynamically in test) |
| pyrefly/lib/test/lsp/lsp_interaction/test_files/autoimport_submodule/autoimport_submodule_pkg/auto_submodule.py | Test submodule containing a VALUE constant for testing |
| pyrefly/lib/test/lsp/lsp_interaction/test_files/autoimport_submodule/autoimport_submodule_pkg/init.py | Package initialization file for test package |
| pyrefly/lib/test/lsp/lsp_interaction/completion.rs | New test case validating submodule auto-import completions |
| pyrefly/lib/state/lsp.rs | Added code action logic to suggest submodule imports in quick-fix suggestions |
| pyrefly/lib/lsp/wasm/completion.rs | Added completion item logic to suggest submodule imports in auto-completion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
6f7267e to
03c0650
Compare
This comment has been minimized.
This comment has been minimized.
49234b4 to
6b196ab
Compare
This comment has been minimized.
This comment has been minimized.
|
Seems like this build is failing for all operating systems. I can take a closer look once that is resolved. |
This comment has been minimized.
This comment has been minimized.
24f57fd to
b2b5d14
Compare
This comment has been minimized.
This comment has been minimized.
b2b5d14 to
8419098
Compare
This comment has been minimized.
This comment has been minimized.
8419098 to
23cce8f
Compare
23cce8f to
50fcdf7
Compare
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
kinto0
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Summary
part of #2207
Added auto-import suggestions for submodules so completions insert
from <parent> import <submodule>(and corresponding quickfix entries).Test Plan
Added a new LSP completion test and fixtures.