stkb / Rewrap

Rewrap extension for VSCode and Visual Studio
https://marketplace.visualstudio.com/items/stkb.rewrap
Other
518 stars 65 forks source link

Wrap to line length #103

Open fogzot opened 6 years ago

fogzot commented 6 years ago

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"

ibbignerd commented 6 years ago

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
fogzot commented 6 years ago

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

gyk commented 5 years ago

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: ...

WolfgangDrescher commented 1 year ago

Are there any plans to implement this?