Skip to content

Add import: Preserve blank lines between comments and import statements #2990

@injust

Description

@injust

Summary

In Zed, using an "import foo" code action in a file with inline script metadata does this:

 # /// script
 # dependencies = ["anyio"]
 # ///
+import anyio
 
 import datetime as dt
 from datetime import UTC

After Ruff formats the imports, you lose the empty line that was after # ///.

Version

ty 0.0.21 (c1ad9f2 2026-03-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixesserverRelated to the LSP server

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions