Skip to content

Commit

Permalink
Fix Javadoc formatting when do not put block tags on separate line set (
Browse files Browse the repository at this point in the history
eclipse-jdt#1415)

- fix problem with block tags not putting newline after closing tag
- revert logic for handling <pre> tags
- fixes eclipse-jdt#1131
  • Loading branch information
jjohnstn authored Sep 22, 2023
1 parent 30ca4c3 commit b552b8d
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -833,13 +833,21 @@ private void handleHtml(TagElement node) {
handleSeparateLineTag(startPos, endPos);
} else if (matcher.start(4) < matcher.end(4)) {
handleBreakBeforeTag(startPos, endPos, isOpeningTag);
if (this.options.comment_javadoc_do_not_separate_block_tags) {
if (!isOpeningTag) {
handleBreakAfterTag(startPos, endPos);
}
}
} else if (matcher.start(5) < matcher.end(5)) {
handleBreakAfterTag(startPos, endPos);
} else if (matcher.start(6) < matcher.end(6)) {
handleNoFormatTag(startPos, endPos, isOpeningTag);
} else if (matcher.start(7) < matcher.end(7)) {
if (this.options.comment_javadoc_do_not_separate_block_tags) {
handleBreakBeforeTag(startPos, endPos, isOpeningTag);
if (!isOpeningTag) {
handleBreakAfterTag(startPos, endPos);
}
} else {
handleSeparateLineTag(startPos, endPos);
}
Expand Down Expand Up @@ -972,12 +980,8 @@ private void handleFormatCodeTag(TagElement tagElement, int startPos, int endPos
return;
}

if (this.options.comment_javadoc_do_not_separate_block_tags) {
handleBreakBeforeTag(startPos, endPos, isOpeningTag);
} else {
// add empty lines before opening and after closing token
handleSeparateLineTag(startPos, endPos);
}
// add empty lines before opening and after closing token
handleSeparateLineTag(startPos, endPos);

int startIndex = tokenStartingAt(startPos);
int endTagIndex = tokenEndingAt(endPos);
Expand Down Expand Up @@ -1045,6 +1049,11 @@ private void handleFormatCodeTag(TagElement tagElement, int startPos, int endPos
this.formatCodeOpenTagEndIndex = -1;
this.lastFormatCodeClosingTagIndex = this.ctm.findIndex(startPos, -1, true);
}
// if (!isOpeningTag) {
// if (this.options.comment_javadoc_do_not_separate_block_tags) {
// handleBreakAfterTag(startIndex, endTagIndex);
// }
// }
}

private void handleSnippet(TagElement node, int startIndex, int endIndex) {
Expand Down

0 comments on commit b552b8d

Please sign in to comment.