Skip to content

Commit 0d36356

Browse files
committed
Provide constants for Markdown formatter
This commit provides constant and fields for markdown formatting enablement & Enable markdown formatting via setDefaultSettings() & setJavaConventionsSettings() partial fix : #4335
1 parent 1863250 commit 0d36356

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

org.eclipse.jdt.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
5-
Bundle-Version: 3.43.100.qualifier
5+
Bundle-Version: 3.43.200.qualifier
66
Bundle-Activator: org.eclipse.jdt.core.JavaCore
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

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: 8 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);
@@ -3063,6 +3069,7 @@ public void setDefaultSettings() {
30633069
this.comment_clear_blank_lines_in_javadoc_comment = false;
30643070
this.comment_format_block_comment = true;
30653071
this.comment_format_javadoc_comment = true;
3072+
this.comment_format_markdown_comment = true;
30663073
this.comment_format_line_comment = true;
30673074
this.comment_format_line_comment_starting_on_first_column = true;
30683075
this.comment_format_header = false;
@@ -3468,6 +3475,7 @@ public void setJavaConventionsSettings() {
34683475
this.comment_clear_blank_lines_in_javadoc_comment = false;
34693476
this.comment_format_block_comment = true;
34703477
this.comment_format_javadoc_comment = true;
3478+
this.comment_format_markdown_comment = true;
34713479
this.comment_format_line_comment = true;
34723480
this.comment_format_line_comment_starting_on_first_column = false;
34733481
this.comment_format_header = false;

0 commit comments

Comments
 (0)