stkb / Rewrap

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

Optionally rewrap entire selection, not just comments #285

Open SteveKing opened 3 years ago

SteveKing commented 3 years ago

The ability to select a large block of code and hit Alt-Q to rewrap comments but not the code is kind of neat, but it interferes with some use cases. INI files (certain dialects, at least) support multiline values by prefixing additional lines with whitespace.

[SECTiON]
tag = This
    is a
    multiline
    value.

Rewrap refuses to rewrap this. Rewrapping comments in INI files works fine, so I presume the refusal here is due to the block being "code", not comment. How about adding a flag to wrap selections unconditionally? If I select something and hit Alt-Q don't bother checking if it's a code or comment, just rewrap it. This doesn't need to be language-specific and pretty-print the code, a normal paragraph wrap would be perfectly fine.

SteveKing commented 3 years ago

This is possibly a dup of issue #136 "Rewrap for all code", but I think that one is looking for wrapping that remains syntactically correct so it would have to be language-aware. This request is just to follow the existing paragraph wrapping rules.