Skip to content

impl Completions: Auto import submodules. #2207#2311

Closed
asukaminato0721 wants to merge 5 commits intofacebook:mainfrom
asukaminato0721:2207-5
Closed

impl Completions: Auto import submodules. #2207#2311
asukaminato0721 wants to merge 5 commits intofacebook:mainfrom
asukaminato0721:2207-5

Conversation

@asukaminato0721
Copy link
Contributor

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.

@meta-cla meta-cla bot added the cla signed label Feb 5, 2026
@asukaminato0721 asukaminato0721 marked this pull request as ready for review February 5, 2026 15:04
Copilot AI review requested due to automatic review settings February 5, 2026 15:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 submodule style 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.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@jvansch1
Copy link
Contributor

Seems like this build is failing for all operating systems. I can take a closer look once that is resolved.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@meta-codesync
Copy link

meta-codesync bot commented Mar 3, 2026

@jvansch1 has imported this pull request. If you are a Meta employee, you can view this in D93606656.

Copy link
Contributor

@kinto0 kinto0 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync
Copy link

meta-codesync bot commented Mar 4, 2026

@jvansch1 merged this pull request in 909c1da.

@asukaminato0721 asukaminato0721 deleted the 2207-5 branch March 4, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants