Skip to content

impl Completions: Import suggestions for explicit re-exports. #2207#2416

Open
asukaminato0721 wants to merge 2 commits intofacebook:mainfrom
asukaminato0721:2207-explicit-re-exports
Open

impl Completions: Import suggestions for explicit re-exports. #2207#2416
asukaminato0721 wants to merge 2 commits intofacebook:mainfrom
asukaminato0721:2207-explicit-re-exports

Conversation

@asukaminato0721
Copy link
Contributor

@asukaminato0721 asukaminato0721 commented Feb 14, 2026

Summary

Fixes part of #2207

Added explicit re-export detection on exports and used it to surface explicit re-export paths in autoimport/quickfix searches.

Test Plan

Added an autoimport test covering explicit re-export suggestions.

@meta-cla meta-cla bot added the cla signed label Feb 14, 2026
@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. ✅

@asukaminato0721 asukaminato0721 marked this pull request as ready for review February 14, 2026 06:41
Copilot AI review requested due to automatic review settings February 14, 2026 06:41
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

Improves Pyrefly’s auto-import completion results so that when a symbol is explicitly re-exported (e.g. from source import Thing as Thing), completions can suggest importing from the re-exporting “public” module rather than only from the canonical/original module. This supports the IDE feature tracker item “Completions: Import suggestions for explicit re-exports” (#2207).

Changes:

  • Add export-metadata plumbing so export searches can detect whether a name is an explicit re-export.
  • Include explicit re-export module paths in search_exports_exact/search_exports_fuzzy results (for user-owned modules).
  • Add an LSP completion test covering the explicit re-export auto-import suggestion.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pyrefly/lib/test/lsp/completion.rs Adds regression test asserting auto-import prefers the explicit re-export path in completion results.
pyrefly/lib/state/state.rs Extends search_exports callback signature to provide Exports metadata alongside computed export maps.
pyrefly/lib/state/lsp.rs Uses explicit re-export detection to include re-export handles in export search results for auto-import completions.
pyrefly/lib/export/exports.rs Adds Exports::is_explicit_reexport to identify ImportAsEq-style definitions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kinto0 kinto0 self-assigned this Feb 18, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 18, 2026

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

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.

2 participants

Comments