swiftlang / swift-format

Formatting technology for Swift source code
Apache License 2.0
2.43k stars 221 forks source link

Column limits don't seem to apply to comments #469

Open dabrahams opened 1 year ago

dabrahams commented 1 year ago

Description

I want column limits respected even in comments, and I want them to be automatically line-wrapped, preserving markdown semantics within doc comments.

Steps to Reproduce

Run swift-format lint on:

// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

It should complain, but does not.

allevato commented 1 year ago

Did you mean to file this over at apple/swift-format?

The current behavior is WAI, but I'd like to make improvements here. Treating comments as Markdown resolves the majority of my concerns around formatting comments (a long URL? Markdown will still preserve it past the line limit. Some fancy ASCII art diagram? Wrap it in triple-backticks to preserve it), but we'll need semver releases over at https://github.com/apple/swift-markdown before we can adopt it.

dabrahams commented 1 year ago

Did you mean to file this over at apple/swift-format?

Uh, yeah. Can it be moved? Should I refile?

WAI

?

allevato commented 1 year ago

Did you mean to file this over at apple/swift-format?

Uh, yeah. Can it be moved? Should I refile?

I've transferred it over.

WAI

?

Working as intended (under the constraints today, which is that I don't want us to implement our own line-breaking logic for prose, and using swift-markdown would fix that).

ahoppen commented 4 months ago

Tracked in Apple’s issue tracker as rdar://126948257