Fix merged line comments#13438
Conversation
f9c6c9d to
329527c
Compare
| if ( | ||
| previousCommentDocType === DOC_TYPE_LINE_SUFFIX || | ||
| (previousCommentDocType === DOC_TYPE_ARRAY && | ||
| getDocType(previousComment.doc[0]) === DOC_TYPE_LINE_SUFFIX) |
There was a problem hiding this comment.
Should we use findInDoc? The printed doc may change in future.
There was a problem hiding this comment.
The tests should save us. findInDoc is recursive. Seems like too much overhead.
As an alternative solution, what if we change the return type of this function to { doc, isBlock, hasLineSuffix }?
|
Since you already got previous comment, may a simple check here https://github.com/thorn0/prettier/blob/ed63ad5928f5ba1dd60e5e6c0fda5906584b3989/src/main/comments.js#L511 will fix #12653? |
#12653 is about leading comments too, not only trailing ones. Let's fix it separately. BTW, we're going to need a new printer method for that check because it's a JS-specific thing. |
Description
Fixes #9959
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.✨Try the playground for this PR✨