question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Line breaking happening at 96 print width?

See original GitHub issue

Not sure if this is related to #8 ?

95 characters:

image

96 characters:

image

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
hosseinmdcommented, Aug 11, 2022

what about this

Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a 
all.

Yes, that is fine, to me.

I understand the issue completely. I just want simple word wrapping, like most word processors do:

Screen Recording 2022-08-11 at 11 17 10 AM (2) Screen Recording 2022-08-11 at 11 17 10 AM (2)

I am willing to bet most other people are just looking for this too. I dont see a reason to make it so complicated with the “fair lines”. It’s cool if you want to add that, but an option for simple word wrapping would be greatly appreciated.

Ok. I Will do it as you want this weekend.

2reactions
vincerubinetticommented, Aug 8, 2022

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:

In other words, don’t try to use printWidth as if it was ESLint’s max-len – they’re not the same. max-len just says what the maximum allowed line length is, but not what the generally preferred length is – which is what printWidth specifies.

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:

image

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 the printWidth.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Line break in a span with defined width? - css - Stack Overflow
How can I break a line in a span once the width of the span is reached? I tried max-width, but this did...
Read more >
When a Line Doesn't Break - CSS-Tricks
This works similar to adding a zero-width space character, but the list items will have no visual separation.
Read more >
Six Word tricks to reduce space between lines - Office Watch
A simple way to reduce the line spacing is to switch from the usual Paragraph Break (pressing Enter) for a Line Break (Shift...
Read more >
Mastering wrapping of flex items - CSS: Cascading Style Sheets
There is however the ability to wrap flex items onto new lines, ... .wrapper { border: 2px dotted rgb(96, 139, 168); width: 500px;...
Read more >
Newline after assignment operator = on long line formatted to ...
Expected behavior: That the line would be broken up such that it does not break the print-width rule. Or at least doesn't change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found