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

Newline after scaladoc annotation #1387

Closed
etspaceman opened this issue Mar 18, 2019 · 8 comments · Fixed by #1987 or #3952
Closed

Newline after scaladoc annotation #1387

etspaceman opened this issue Mar 18, 2019 · 8 comments · Fixed by #1987 or #3952

Comments

@etspaceman
Copy link

etspaceman commented Mar 18, 2019

Recently I had a requirement to move descriptions for scaladoc annotations to a new line. E.g.:

/* Some scaladoc for my class
* @tparam someTParam This is a description for my type-param
* @param someParam This is a description for my param
...
*/

Becomes:

/* Some scaladoc for my class
* @tparam 
* someTParam This is a description for my type-param
* @param someParam 
* This is a description for my param
...
*/

I would love to see this as an officially supported option in scalafmt.

@kitbellew
Copy link
Collaborator

@etspaceman generally, scalafmt formats code, not comments. i doubt it will be implemented.

@etspaceman
Copy link
Author

There are format rules for this kind of stuff in docstrings... so I would think something like this could absolutely fall under the responsibility of scalafmt

@kitbellew
Copy link
Collaborator

@etspaceman you're right, it could. there's a similar issue (possibly a superset): #1234

@Scarysize
Copy link

Sorry to chime into this old issue. Is there a way to prevent a newline after a scaladoc annotation?

/**
 * Foo bar lorem...
 *
 * @tparam C This sentence should stay on the same line as the type parameter annotation
 */

@tgodzik
Copy link
Contributor

tgodzik commented Aug 23, 2021

@Scarysize
Copy link

docstring.wrap = no did work. Thanks!

@NihalJain
Copy link

docstring.wrap = no did work. Thanks!

I think you meant docstrings.wrap = no, anyways thanks!

@coryfklein
Copy link

I wish there was a way to keep docstring.wrap enabled, but only disable the specific thing the OP asked for: splitting annotation descriptions onto a newline! If your comments are terse, you don't really want to break them into newlines.

For example:

/**
  * @return something great
  */

Becomes

/**
  * @return
  *   something great
  */

Obviously if you have 3 paragraphs of english after @return then the newline sets this content off nicely, but for shorter scaladocs it's such a waste.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants