hosseinmd / prettier-plugin-jsdoc

A Prettier plugin to format JSDoc comments.
MIT License
228 stars 29 forks source link

Feature request: jsdocLineWrappingStyle: 'keep' #197

Closed plehnen closed 11 months ago

plehnen commented 1 year ago

Hi, I was looking for a plugin like this, which formats jsdoc comments. But unfortunately this is breaking some lines in a way which doesn't look good.

Sometimes adding an own line break is just more beautiful and easier to read. Being able to set jsdocLineWrappingStyle to "keep" would be nice.

plehnen commented 1 year ago

(In case it detects intentional line breaks it also should not convert it into a single line comment)

hosseinmd commented 1 year ago

Adding jsdocSingleLineComment false in prettierrc could help you

plehnen commented 1 year ago

Unfortunately not. The reason why I was looking for such a plugin was exactly that reason: I wanted to automatically collapse multi-line comments into single lines whenever possible.

If my line length exceeds the allowed limit, it should wrap it. But if I wrap the lines intentionally (i.e. between two sentences, so not a single word remains in the second line alone), or if it is wrapping exactly between a string which shouldn't be broken), then I want it to keep the line breaks.

hosseinmd commented 1 year ago

This plugin isn't meant to do that, the plugin is formatting to beautiful form not uglifying, however this is so simple to do. Unfortunately, I don't have enough time to do this now.