Rewrap icon indicating copy to clipboard operation
Rewrap copied to clipboard

Wrap to line length

Open fogzot opened this issue 7 years ago • 4 comments

Comments are usually indented to align with the code and when rewrapping more indented code results in shorter comment lines. It would be nice if Rewrap could wrap the comments to an absolute line length instead of a fixed column. Something like "always make the comment lines 60 characters"

fogzot avatar Sep 06 '18 10:09 fogzot

To be clear, this is what you are proposing, yes?

Current

"rewrap.wrappingColumn": 50,

// This is a comment that will wrap at n chars and |
// go to the next line as expected                 |
          // This comment should have an allowed   |
          // line length and not be wrapped at the |
          // wrappingColumn value                  |

Proposed

"rewrap.lengthType": "length", // ["length", "column"]
"rewrap.wrappingLength": 50,

// This is a comment that will wrap at n chars and |
// go to the next line as expected                 |
          // This comment should have an allowed line length
          // and not be wrapped at the wrappingColumn value

ibbignerd avatar Sep 07 '18 18:09 ibbignerd

Yes, that's exactly what I'd like to be able to do. :)

fogzot avatar Sep 10 '18 11:09 fogzot

It would be best to have two constraints at the same time: the width of the comment itself, and the maximum line width in general.

Quoting the Rust Style Guide:

Source lines which are entirely a comment should be limited to 80 characters in length (including comment sigils, but excluding indentation) or the maximum width of the line (including comment sigils and indentation), whichever is smaller: ...

gyk avatar Dec 28 '18 03:12 gyk

Are there any plans to implement this?

WolfgangDrescher avatar Jan 10 '23 12:01 WolfgangDrescher