-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treat single-star comments as JSDoc #5206
Conversation
Alternate heuristic: either a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you marked this as WIP, but I like it already :)
@j-f1 How do you feel about this one? |
Sorry, I haven’t had a chance to refactor the heuristic yet @lydell. I’ll take a look at that this afternoon/evening (EDT). |
Is this an intended change? Prettier 1.14.3 --parser babylon Input: /** one
* two
*/ Output: /** one
* two
*/ Prettier pr-5206 --parser babylon Input: /** one
* two
*/ Output: /** one
* two
*/ |
Sort of. Should I allow arbitrary text on the first line in both |
First line: Anything goes, I’d say. I can’t see a reason to restrict the first line in any way? |
Perhaps the function should be called something like |
Could you add these tests?
|
Btw, would this work? function isIndentableBlockComment(comment) {
// If the comment has multiple lines and every line starts with a star
// we can fix the indentation of each line. The stars in the `/*` and
// `*/` delimiters are not included in the comment value, so add them
// back first.
const lines = `*${comment.value}*`.split("\n");
return lines.length > 1 && lines.every(line => line.trim()[0] === "*");
} EDIT: Updated code. |
@j-f1 I took the liberty to update your branch with my suggestions myself. What do you think? |
LGTM. Good to merge? (cc @duailibe too) |
Fixes #5194. Are the other changes to the snapshots reasonable?