stkb/Rewrap

Rewrap replaces spaces with null characters inside Javadoc tags in the presence of HTML tags in some situations

Opened this issue · 0 comments

lgo commented

This is a weird one that stumped me when it happened randomly and even more once I tried writing examples that did reproduce the bug or didn't. When the comment is adjusted to no longer cause the issue, rewrap will actually reverse the effect and replace the null characters with spaces. Here's a variety of reproducing javadoc comments.

/** <p>{@link Foo} */
/** <ul>{@code Foo} */
/** <ul>{@code   Foo   } */
/** <p>{@link Foo}</p> */
/** <p><ul>{@link Foo}</p></ul> */
/** <p></p> {@link Foo}*/
/** <p></p>
 * {@link Foo}
 */

And for comparison, these do not reproduce.

/** <p>{link Foo} */
/** <p>{ } */
/** <p>{@link} */
/** <p>
 * {@link Foo}</p> */

// Yes, an extra line makes the difference on this one!
/** <p></p>
 *
 * {@link Foo}
 */

You can copy and paste those and run rewrap on the whole file.

Here's my editor information.

VSCode version info:

Version: 1.88.0 (Universal)
Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
Date: 2024-04-03T13:28:18.899Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.5.0

Rewrap version: v1.16.3