Skip to content

Commit

Permalink
FormatWriter: fold long oneline javadoc if no wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jun 18, 2020
1 parent a5e1951 commit 3074f39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ class FormatWriter(formatOps: FormatOps) {
}) && {
val content = matcher.group(2)
val folding = // 7 is the length of "/** " and " */"
content.length <= style.maxColumn - prevState.indentation - 7
content.length <= style.maxColumn - prevState.indentation - 7 ||
(style.docstrings.wrap eq Docstrings.Wrap.no)
if (folding) sb.append("/** ").append(content).append(" */")
folding
}
Expand Down
16 changes: 4 additions & 12 deletions scalafmt-tests/src/test/resources/test/JavaDoc.stat
Original file line number Diff line number Diff line change
Expand Up @@ -1236,12 +1236,8 @@ object a {
>>>
object a {

/**
* alias for [[literal]]
*/
/**
* alias for [[literal]]
*/
/** alias for [[literal]] */
/** alias for [[literal]] */
}
<<< #2028 Asterisk long, keep, !wrap
docstrings.style = Asterisk
Expand All @@ -1260,10 +1256,6 @@ object a {
>>>
object a {

/**
* alias for [[literal]]
*/
/**
* alias for [[literal]]
*/
/** alias for [[literal]] */
/** alias for [[literal]] */
}

0 comments on commit 3074f39

Please sign in to comment.