prettier-plugin-jsdoc: Line breaking happening at 96 print width?
Not sure if this is related to #8 ?
95 characters:

96 characters:

I’d expect it to wrap such that no characters (including the comment characters) exceed the print width (shown in the screenshot with the vertical line).
This is my .prettierrc
:
{
"plugins": ["./node_modules/prettier-plugin-jsdoc"],
"jsdocCapitalizeDescription": false,
}
No override of the default printWidth
of 80
, so it should be 80
. Also the rest of my code formats properly to 80
.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 17 (14 by maintainers)
Ok. I Will do it as you want this weekend.
Okay, according to this comment, I guess this was actually a feature:
https://github.com/hosseinmd/prettier-plugin-jsdoc/issues/26#issuecomment-771823206
I was going to say that this was a weird error in judgement. I don’t know of any word processor that tries to “smart” wrap like this. MS Word doesn’t do it. VSCode’s word wrap doesn’t do it. Etc.
However, apparently Prettier does sort of do it:
Despite all this, I wish there was a way to disable this behavior. I would like to just have it hard wrap at
printWidth
always. I really think this looks stupid and is unexpected:Also, I can’t verify this, but it seems like Prettier does actually hard wrap at
printWidth
whenever possible, but sometimes it’s not able to, e.g a long string literal, hence why they say it sometimes produces lines over theprintWidth
.Released v0.4.1
I’m sorry for being forceful. I’m guess I’m used to library developers making a baffling decision (in my opinion) and refusing to even consider changing it. But you are not like that. Thank you.
I am working on a PR now for this change. I’ll also tag @egilll in it so that we can coordinate our fixes. I’m not familiar with this code base, so it might be a bad PR, and I’ll still need your help @hosseinmd.
But I should at least create a starting point, since I am the one requesting this change.
I don’t like this feature too, I prefer a new line even if it’s only 1 word on the new line, so I have more consistency in my line widths. But since this is implemented and some people want this, maybe we can turn this into an option that can be configured.