Skip to content

Commit ad21f54

Browse files
committed
Provide constants for Markdown formatter
This commit provides constant and fields for markdown formatting enablement partial fix : #4335
1 parent 3e46a17 commit ad21f54

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,19 @@ public class DefaultCodeFormatterConstants {
15101510
*/
15111511
public final static String FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT = "org.eclipse.jdt.core.formatter.comment.format_javadoc_comments"; //$NON-NLS-1$
15121512

1513+
/**
1514+
* <pre>
1515+
* FORMATTER / Option to control whether markdown comments are formatted
1516+
* - option id: "org.eclipse.jdt.core.formatter.comment.format_markdown_comments"
1517+
* - possible values: { TRUE, FALSE }
1518+
* - default: TRUE
1519+
* </pre>
1520+
* @see #TRUE
1521+
* @see #FALSE
1522+
* @since 3.43
1523+
*/
1524+
public final static String FORMATTER_COMMENT_FORMAT_MARKDOWN_COMMENT = "org.eclipse.jdt.core.formatter.comment.format_markdown_comments"; //$NON-NLS-1$
1525+
15131526
/**
15141527
* <pre>
15151528
* FORMATTER / Option to control whether the header comment of a Java source file is formatted

org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ public static DefaultCodeFormatterOptions getJavaConventionsSettings() {
238238
public boolean comment_new_lines_at_javadoc_boundaries;
239239
public boolean comment_javadoc_do_not_separate_block_tags;
240240
public boolean comment_format_javadoc_comment;
241+
public boolean comment_format_markdown_comment;
241242
public boolean comment_format_line_comment;
242243
public boolean comment_format_line_comment_starting_on_first_column;
243244
public boolean comment_format_block_comment;
@@ -667,6 +668,7 @@ public Map<String, String> getMap() {
667668
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, this.comment_format_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
668669
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML, this.comment_format_html ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
669670
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT, this.comment_format_javadoc_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
671+
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_MARKDOWN_COMMENT, this.comment_format_markdown_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
670672
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT, this.comment_format_line_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
671673
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN, this.comment_format_line_comment_starting_on_first_column ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
672674
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, this.comment_format_source ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
@@ -1570,6 +1572,10 @@ public void set(Map<String, String> settings) {
15701572
if (commentFormatJavadocCommentOption != null) {
15711573
this.comment_format_javadoc_comment = DefaultCodeFormatterConstants.TRUE.equals(commentFormatJavadocCommentOption);
15721574
}
1575+
final Object commentFormatMarkdownCommentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_MARKDOWN_COMMENT);
1576+
if (commentFormatMarkdownCommentOption != null) {
1577+
this.comment_format_markdown_comment = DefaultCodeFormatterConstants.TRUE.equals(commentFormatMarkdownCommentOption);
1578+
}
15731579
final Object commentFormatBlockCommentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT);
15741580
if (commentFormatBlockCommentOption != null) {
15751581
this.comment_format_block_comment = DefaultCodeFormatterConstants.TRUE.equals(commentFormatBlockCommentOption);

0 commit comments

Comments
 (0)