Rewrap
Rewrap copied to clipboard
Request: always wrap when asked explicitly
Hello,
Thank you for Rewrap, a crucial feature somehow missing from vscode. That said, when dealing with Perl POD, I cannot convince Rewrap to do anything with plain text paragraphs. I tried selecting a paragraph and the usual ALT-Q, but I have to reflow my documentation manually, which is painful.
What technically prevents Rewrap from obeying when I highlight some text I want rewrapped?
Below is a Perl POD example, although my question is actually not language-specific: I think that ALT-Q should always rewrap what's highlighted (or the current paragraph) even if it is of an unrecognized format as seems to be the case here. Users can always CTRL-Z back if the result isn't satisfactory.
=head1 DESCRIPTION
=head2 Overview
This is a paragraph which Rewrap will refuse to touch even though it's essentially plain text.
=cut
use strict;
use warnings;
# This is a Perl comment which
# Rewrap will gladly handle.
I had this same question and found this issue. A workaround I've found is to comment my selection (ctrl+/
), wrap it (alt+q
), then uncomment (ctrl+/
). :man_shrugging:
I think this is a really crucial feature, and the lack of it is making me look for other plugins. I often run into certain syntax which this plug-in won't let me wrap, such as Python doc strings. I think this should be an easy tweak for any reader familiar with extension programming?
This is actually how the extension worked to begin with, but I had to change it. I don't remember off the top of my head why exactly, but I will look it up
@stkb Have you had a chance to look into this? Can we be given the option to simply select a lump of text and use rewrap to wrap it rather than it being recognised as wrappable comment by Rewrap itself?
@fy2 Yeah, I don't have the all the details any more but basically it made the code much simpler not to have this.
However since this is a popular request I will add it back. I am working on something of a rewrite anyway and will add it into there.
As another workaround in the mean time you can also copy the text into a new buffer, and it will be wrapped as plain text in there, and then copy it back.
As another work-around, you can change the file mode to plain text and then rewrap.
I ran into this with pod as well. Looking forward to seeing this when available.