Rewrap
Rewrap copied to clipboard
Valid comments with unusual comment markers are not wrapped correctly.
While working on a shell script, I discovered that Rewrap doesn't behave the way I expected — when I use ### to start a comment instead of just # (I'm using the former as kind of a makeshift "doc comment"), triggering a rewrap simply does nothing at all. A quick test in JavaScript shows a different, but equally undesirable, behavior. The following examples were created by setting the editor mode to the referenced language, typing the unwrapped text, and then triggering the "Rewrap/Unwrap Text At Column…" command, with width 40, on each line.
Shell script
Unusual comment markers cause the entire line to be ignored.Before
# This is a long comment which will get wrapped.
## This is another long comment, but it will NOT get wrapped!
### This is another long comment which won't get wrapped.
After
# This is a long comment which will get
# wrapped.
## This is another long comment, but it will NOT get wrapped!
### This is another long comment which won't get wrapped.
JavaScript
Unusual comment markers are wrapped, but in an undesirable manner — in this example, the four-slash comment both has its comment marker truncated on wrapped lines and also omits the space after the comment marker. (Presumably, the entire line is interpreted as "a three-slash comment without a space after the comment marker", from which point of view the exhibited behavior is perfectly consistent.)Before
// This is a long comment which will get wrapped correctly.
/// This is another long comment which will also get wrapped correctly.
//// But this is a long comment which will NOT get wrapped correctly!
After
// This is a long comment which will get
// wrapped correctly.
/// This is another long comment which
/// will also get wrapped correctly.
//// But this is a long comment which
///will NOT get wrapped correctly!
Environment
- OS: Linux 5.19.0-26-generic x86_64
- VS Code: 1.74.3
- Rewrap: 1.16.3