Skip to content

Black puts "pyright: ignore" comments on the wrong line #3946

@RobinFrcd

Description

@RobinFrcd

Hi,
I've switched to VS code and pyright recently, and I realized black is breaking a lot of # pyright: ignore comments.

Input (both are valid for pyright):

asm_client: SecretsManagerClient = boto3.client("secretsmanager") # pyright: ignore[reportUnknownMemberType]
asm_client: SecretsManagerClient = boto3.client( # pyright: ignore[reportUnknownMemberType]
    "secretsmanager"
)  

Output:

asm_client: SecretsManagerClient = boto3.client(
    "secretsmanager"
)  # pyright: ignore[reportUnknownMemberType]
asm_client: SecretsManagerClient = boto3.client(
    "secretsmanager"
)  # pyright: ignore[reportUnknownMemberType]

Is there a way to stick the pyright comment to the original line ?

I'm using:

black, 23.9.1 (compiled: yes)
Python (CPython) 3.11.6

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.T: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions