You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pyrefly inserted typing import in sub-optimal location #1490
When I started typing ClassVar in a file in which I hadn't imported typing.ClassVar, Pyrefly brought up ClassVar as a completion suggestion (very helpful!), but it inserted from typing import ClassVar at the very top of my imports list. Ideally, it would have merged ClassVar into my existing from typing import ... line, or at least inserted the new typing import line right above/below the existing one.
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
Activity
yangdanny97 commentedon Nov 4, 2025
Do formatters automatically sort/merge imports? If so, I imagine this wouldn't be an issue for folks that have a format-on-save turned on
rchen152 commentedon Nov 4, 2025
Ah, good point. When I have format-on-save turned on, the formatter does combine the import lines on save.
KRRT7 commentedon Nov 5, 2025
pyrefly did a similar thing where it did the import above
from __future__ import annotationswhich is incorrectasukaminato0721 commentedon Jul 8, 2026
#claim
github-actions commentedon Jul 8, 2026
@asukaminato0721 you've claimed this issue — it's now assigned to you. Thanks for picking it up! 🎉
fix Pyrefly inserted typing import in sub-optimal location #1490 (#5443)