Skip to content

Formatting instability with 'with' statement and trailing line comment #787

Description

@Rel1cx

Describe the bug

dprint version: 0.54.0
TypeScript plugin version: 0.96.1

When formatting a with statement that has a trailing line comment after the opening brace, dprint reports "Formatting not stable. Bailed after 5 tries."

Input Code

with (a) { //
}

Expected Output

Should format stably (or at least not error).

Actual Output

Error formatting repro.ts. Message: Formatting not stable. Bailed after 5 tries.

Additional context

  • Reproduction repository: https://github.com/Rel1cx/dprint-bug-repro
  • Removing the comment (//) makes the error disappear.
  • Removing the block braces (e.g. with (a) 1; //) also makes the error disappear.
  • The bug also affects .js and .md files containing this code snippet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions