Skip to content

Handle import fixes for unimported directives#4044

Open
aodihis wants to merge 1 commit into
facebook:mainfrom
aodihis:feature/3859
Open

Handle import fixes for unimported directives#4044
aodihis wants to merge 1 commit into
facebook:mainfrom
aodihis:feature/3859

Conversation

@aodihis

@aodihis aodihis commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #3859
The issue #3859 is caused by an unhandled UnimportedDirective error kind. If we look at pyrefly/lib/state/lsp.rs, Pyrefly only handled the import action for the UnknownName error kind.

This PR updates the existing import quick-fix path so UnimportedDirective is handled alongside UnknownName.

Test Plan

Added coverage for the scenario where unimported directives such as reveal_type and assert_type should produce an import quick fix from typing.

reveal_type and assert_type produce UnimportedDirective diagnostics, so the existing unknown-name import action path should also consider that error kind. This lets the normal export search produce typing imports for those directives and adds regression coverage for both names.
@meta-cla meta-cla Bot added the cla signed label Jul 4, 2026
@github-actions github-actions Bot added the size/s label Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

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

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.

reveal_type don't have code action to import

1 participant