fix Pyrefly inserted typing import in sub-optimal location #1490#1580
Open
asukaminato0721 wants to merge 6 commits into
Open
fix Pyrefly inserted typing import in sub-optimal location #1490#1580asukaminato0721 wants to merge 6 commits into
asukaminato0721 wants to merge 6 commits into
Conversation
e9cb6aa to
c26aa04
Compare
df5401f to
e3180ab
Compare
Contributor
jvansch1
reviewed
Nov 26, 2025
jvansch1
reviewed
Nov 26, 2025
efd8d5f to
5af20b8
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
|
@asukaminato0721 Are you still planning to make changes to this PR? I see there are some failing checks. |
b1b818e to
0e46400
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
13633fe to
e2b5ced
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
|
@jvansch1 let's get this one merged? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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. |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.