Skip to content

[Formatter] Handle Markdown in EnumDeclaration#5033

Merged
mateusz-matela merged 1 commit into
eclipse-jdt:masterfrom
SougandhS:EnumMarkdown
May 11, 2026
Merged

[Formatter] Handle Markdown in EnumDeclaration#5033
mateusz-matela merged 1 commit into
eclipse-jdt:masterfrom
SougandhS:EnumMarkdown

Conversation

@SougandhS
Copy link
Copy Markdown
Member

@SougandhS SougandhS commented Apr 27, 2026

This commit fixes the IOBE on formatting Markdown in Enum declaration part

Fixes : #5032

What it does

How to test

Author checklist

@SougandhS SougandhS changed the title Handle Markdown in EnumDeclaration [Formatter] Handle Markdown in EnumDeclaration Apr 27, 2026
@SougandhS
Copy link
Copy Markdown
Member Author

Hi @mateusz-matela, could you please check this PR too

Copy link
Copy Markdown
Member

@mateusz-matela mateusz-matela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And how about a unit test?

Copy link
Copy Markdown
Member

@mateusz-matela mateusz-matela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the unit test? do you intentionally skip it?

EnumConstantDeclaration declaration = enumConstants.get(i);
if (declaration.getJavadoc() != null)
this.tm.firstTokenIn(declaration, TokenNameCOMMENT_JAVADOC).breakBefore();
this.tm.firstTokenIn(declaration, ANY).breakBefore();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was suggesting firstTokenIn(declaration.getJavadoc(), ANY) - it seems safer. Otherwise one may wonder if it's always true that the very first token in a declaration has to be the javadoc (and will it always be true in the future?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it now, 👍 updated

@SougandhS SougandhS force-pushed the EnumMarkdown branch 2 times, most recently from 4f97489 to b289f84 Compare May 7, 2026 01:30
@SougandhS
Copy link
Copy Markdown
Member Author

SougandhS commented May 7, 2026

and the unit test? do you intentionally skip it?

Missed by mistake, added now 👍 (missed to commit earlier)

@SougandhS SougandhS force-pushed the EnumMarkdown branch 4 times, most recently from 1178536 to b4217c7 Compare May 11, 2026 03:58
This commit fixes the IOBE on formatting Markdown in Enum declaration
part

Fixes : eclipse-jdt#5032
@mateusz-matela mateusz-matela merged commit 3a7e978 into eclipse-jdt:master May 11, 2026
13 checks passed
@SougandhS
Copy link
Copy Markdown
Member Author

Thank you @mateusz-matela !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error formatting javadoc markdown on enum constants

2 participants