Skip to content

Pyrefly inserted typing import in sub-optimal location #1490

@rchen152

Description

@rchen152

Describe the Bug

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.

Image

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    language-serverIssues specific to our IDE integration rather than type checking

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions