Skip to content

There should be a way to join hard-wrapped line comments #1235

Description

@itingliu

Background

swift-format supports reflowing prose in some scenarios:

  • respectsExistingLineBreaks: false collapses manually-wrapped code that fits within lineLength
  • reflowMultilineStringLiterals does the same for multiline string literals.

Line comments should be supported too.

Current behavior

When respectsExistingLineBreaks == false and lineLength is permissive (e.g. 250), the formatter will collapse a hand-broken function call onto one line but leave this untouched:

// This comment was written at an 80-column
// terminal and never updated.

There is no existing rule or configuration flag for this. This results in inconsistent format when the project with wider line lengths use respectsExistingLineBreaks: false to collapse code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions