google-java-format icon indicating copy to clipboard operation
google-java-format copied to clipboard

Multiline TODO formatting is incorrect

Open ColtonIdle opened this issue 1 year ago • 2 comments

Transplanting this issue https://github.com/facebook/ktfmt/issues/239

ColtonIdle avatar Jun 06 '24 04:06 ColtonIdle

To confirm, it sounds like the report is that given a TODO like:

// TODO: We still have a lot of work to do here. We still have a lot of work to do here. We still have a lot of work to do here. We still have a lot of work to do here.

... the formatter will wrap it to two lines like this:

// TODO: We still have a lot of work to do here. We still have a lot of work to do here. We still
// have a lot of work to do here. We still have a lot of work to do here.

And IntelliJ has a feature that recognize multi-line TODOs and highlights them, but only if the following lines have additional indentation, and you would like the formatter to do that automatically?

  // TODO: We still have a lot of work to do here. We still have a lot of work to do here. We still
- // have a lot of work to do here. We still have a lot of work to do here.
+ //  have a lot of work to do here. We still have a lot of work to do here.

Note that the formatter won't change // comments in this way unless there longer than the column limit, so if there are existing comments with the extra space that don't need wrapping it will leave them alone.

cushon avatar Jul 20 '24 15:07 cushon

Yeah, that sounds right to me.

ColtonIdle avatar Jul 20 '24 16:07 ColtonIdle