Join hyphenated words broken across lines in Javadoc comments. · openjavaformat/open-java-format@4cf17dd · GitHub
Skip to content

Commit 4cf17dd

Browse files
cushonabashev
authored andcommitted
Join hyphenated words broken across lines in Javadoc comments.
When a compound word was hyphenated across a line break in Javadoc (e.g., `infinite-\n * precision`), the formatter previously joined the tokens with a space, resulting in `infinite- precision`. Join adjacent word literals across a line break when the preceding literal ends in a hyphen following a word character, while preserving spaces after suspended hyphens (e.g., `pre- and post-`). Ported from google/google-java-format#1475 (commit 55863463), adapted to this fork's Token API. The markdown `///` test does not apply here. The tests were written first: hyphenatedLineBreakJoined failed with `infinite- precision`, suspendedHyphenPreserved and hyphenBeforeParagraphBreakNotJoined guard the cases that must stay as they are.
1 parent a9a4744 commit 4cf17dd

2 files changed

Lines changed: 80 additions & 4 deletions

File tree

‎open-java-format/src/main/java/com/palantir/javaformat/java/javadoc/JavadocLexer.java‎

Lines changed: 27 additions & 4 deletions

‎open-java-format/src/test/java/com/palantir/javaformat/java/JavadocFormattingTest.java‎

Lines changed: 53 additions & 0 deletions

0 commit comments

Comments
 (0)