Skip to content

fix Pyrefly inserted typing import in sub-optimal location #1490#1580

Open
asukaminato0721 wants to merge 6 commits into
facebook:mainfrom
asukaminato0721:1490
Open

fix Pyrefly inserted typing import in sub-optimal location #1490#1580
asukaminato0721 wants to merge 6 commits into
facebook:mainfrom
asukaminato0721:1490

Conversation

@asukaminato0721

@asukaminato0721 asukaminato0721 commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

fixes #1490 fixes #3382

Adjusted so insert_import_edit* returns an ImportEdit with both the actual edit and a stable display string, and added logic to append new symbols to an existing matching from ... import ... statement instead of duplicating the import line. The helper now shares this richer info with callers so UI text stays human-readable.

Updated LSP code to consume the new struct, ensuring code-action titles and auto-import completion details still show from module import name while the actual edit mutates the existing line in place.

Taught the infer command to handle the new edit type and to skip empty/duplicate insertions when mutating files.

Revised the LSP code-action test to assert the merged-import behavior.

@meta-cla meta-cla Bot added the cla signed label Nov 14, 2025
@asukaminato0721 asukaminato0721 force-pushed the 1490 branch 2 times, most recently from df5401f to e3180ab Compare November 18, 2025 10:45
@asukaminato0721 asukaminato0721 marked this pull request as ready for review November 18, 2025 10:54
@asukaminato0721 asukaminato0721 marked this pull request as draft November 18, 2025 12:36
@meta-codesync

meta-codesync Bot commented Nov 20, 2025

Copy link
Copy Markdown
Contributor

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

@asukaminato0721 asukaminato0721 marked this pull request as ready for review November 21, 2025 11:57
Comment thread pyrefly/lib/test/lsp/completion.rs
Comment thread pyrefly/lib/state/ide.rs Outdated
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the stale label Jan 15, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added the stale label Feb 2, 2026
@jvansch1

jvansch1 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

@asukaminato0721 Are you still planning to make changes to this PR? I see there are some failing checks.

@asukaminato0721 asukaminato0721 force-pushed the 1490 branch 2 times, most recently from b1b818e to 0e46400 Compare February 3, 2026 16:16
@asukaminato0721 asukaminato0721 marked this pull request as ready for review February 3, 2026 16:18
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings February 11, 2026 18:25
@github-actions

This comment has been minimized.

@yangdanny97

Copy link
Copy Markdown
Contributor

@jvansch1 let's get this one merged?

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@yangdanny97 yangdanny97 self-assigned this May 25, 2026
@yangdanny97

Copy link
Copy Markdown
Contributor

Sorry this one's taking a bit longer to review because it's doing a lot of things at once. No action needed from you ATM but in the future a smaller more focused changeset would help us get things reviewed faster.

@github-actions

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