Skip to content

Commit d1704b0

Browse files
committed
Add option to enable or disable markdown formatting
This commit provides ui to enable or disbale markdown formatting partial fix : eclipse-jdt/eclipse.jdt.core#4335
1 parent c6938dc commit d1704b0

4 files changed

Lines changed: 6 additions & 2 deletions

File tree

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ private FormatterMessages() {
530530
public static String ModifyDialogTabPage_error_msg_values_items_text_unassigned;
531531
public static String ModifyDialogTabPage_NumberPreference_error_invalid_key;
532532
public static String ModifyDialogTabPage_NumberPreference_error_invalid_value;
533+
public static String FormatterModifyDialog_comments_pref_enable_markdown;
533534

534535
static {
535536
NLS.initializeMessages(BUNDLE_NAME, FormatterMessages.class);

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ FormatterModifyDialog_comments_pref_format_header=Enable header comment formatti
348348
FormatterModifyDialog_comments_pref_format_html=Format HTML tags
349349
FormatterModifyDialog_comments_pref_format_code_snippets=Format Java code snippets inside 'pre' tags
350350
FormatterModifyDialog_comments_pref_format_line_comments_on_first_column=Format line comments on first column
351+
FormatterModifyDialog_comments_pref_enable_markdown=Enable Markdown comment formatting
351352

352353
FormatterModifyDialog_comments_pref_remove_blank_lines=Remove blank lines
353354
FormatterModifyDialog_comments_pref_blank_line_before_javadoc_tags=Blank line before Javadoc tags

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterModifyDialog.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,7 @@ private void createCommentsTree() {
15781578
.gap()
15791579
.pref(FormatterMessages.FormatterModifyDialog_comments_pref_enable_javadoc, DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT)
15801580
.pref(FormatterMessages.FormatterModifyDialog_comments_pref_enable_block, DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT)
1581+
.pref(FormatterMessages.FormatterModifyDialog_comments_pref_enable_markdown, DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT)
15811582
.pref(FormatterMessages.FormatterModifyDialog_comments_pref_enable_line, DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT, pref -> {
15821583
CheckboxPreference child= fTree.addCheckbox(pref, FormatterMessages.FormatterModifyDialog_comments_pref_format_line_comments_on_first_column,
15831584
DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN, CheckboxPreference.FALSE_TRUE);

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaFormattingContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2017 IBM Corporation and others.
2+
* Copyright (c) 2000, 2024 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -49,7 +49,8 @@ public String[] getPreferenceKeys() {
4949
DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH,
5050
DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT,
5151
DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT,
52-
DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML }; }
52+
DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML,
53+
DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_MARKDOWN_COMMENT};}
5354

5455

5556
/*

0 commit comments

Comments
 (0)