Skip to content
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

Print newline after doc comments before attributes #1869

Merged
merged 3 commits into from Jun 5, 2018

Conversation

zploskey
Copy link
Contributor

@zploskey zploskey commented Mar 16, 2018

Forces a line break following doc comments before the first non-comment attribute on a BuckleScript external.

Before:

/** doc comment */ [@bs.send] external url : t => string = "";

/**
 * Short multiline doc comment
 */ [@bs.send]
external url : t => string = "";

/** Longer doc comment before an attribute on an external. */ [@bs.send]
external url : t => string = "";

/* normal comment */
[@bs.send] external url : t => string = "";

After:

/** doc comment */
[@bs.send]
external url : t => string = "";

/**
 * Short multiline doc comment
 */
[@bs.send]
external url : t => string = "";

/** Longer doc comment before an attribute on an external. */
[@bs.send]
external url : t => string = "";

/* normal comment */
[@bs.send] external url : t => string = "";

Fixes #1857.

@zploskey
Copy link
Contributor Author

Rebased and added an additional test case for short multi-line doc comments preceding externals.

@chenglou
Copy link
Member

cc @rickyvetter

@jordwalke
Copy link
Member

Are there sufficient test cases on non-extern items that have doc comments? (Like type definitions and regular let bindings?) If not, would you care to add them so I can merge?

@zploskey
Copy link
Contributor Author

I added more tests for doc comments on type and let statements. Let me know if there are any others you might like to see.

@zploskey
Copy link
Contributor Author

@jordwalke Did you have any other issues with this patch?

Forces a line break following doc comments before the first
non-comment attribute on a BuckleScript external.

Before:

/** doc comment */ [@bs.send] external url : t => string = "";

/**
 * Short multiline doc comment
 */ [@bs.send]
external url : t => string = "";

After:

/** doc comment */
[@bs.send]
external url : t => string = "";

/**
 * Short multiline doc comment
 */
[@bs.send]
external url : t => string = "";
Doc comments were previously disabled.
@zploskey zploskey force-pushed the break_between_doc_and_attribute branch from a3c8c51 to 3ad1c82 Compare May 24, 2018 03:09
@zploskey
Copy link
Contributor Author

I rebased this on master and reworked it to use partitionAttributes now that it can handle doc comments again. If there is a simpler way to do something here please let me know. I'm eager to get this merged so I don't have to keep padding out my doc comments just so the attributes don't wind up on the same line as them.

@zploskey
Copy link
Contributor Author

zploskey commented Jun 5, 2018

CC @IwanKaramazow

@IwanKaramazow
Copy link
Contributor

@zploskey This looks great! Thanks for the effort, I'll ping @chenglou to make sure it gets merged.

@chenglou
Copy link
Member

chenglou commented Jun 5, 2018

Good stuff. Thanks @zploskey!

@chenglou chenglou merged commit 1502999 into reasonml:master Jun 5, 2018
@zploskey zploskey deleted the break_between_doc_and_attribute branch June 5, 2018 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants