-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Formatting with Java Enhanced Switch Statement #55903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-format |
Can you make a smaller producer? |
@mydeveloperday Are you asking me for that? If so, what do you mean by producer? |
If you're asking me to shortening the configuration file to specifically reference the configs that aren't working or something, I can't. I have no idea what specific configuration is preventing the formatting after the enhanced switch case. I think it might be more of a parser problem or something. Additionally, I include the whole java file so you can see how it's not formatted to the configuration specifications, after the enhanced switch case. |
I can reproduce only with:
and LLVM default style. Expected (probably, not sure whether arrows should have newlines before/after or not):
Mind that this is formatted ok:
Result as expected:
|
@llvm/issue-subscribers-good-first-issue |
The problem must be pretty trivial, we only handle colons |
I'll work on it |
Any updates on this? |
I would like to try to fix it but I don't know where to start. I searched on the source code and I found function |
Any updates/findings on this issue? Adding clang-format code owners @mydeveloperday @owenca to clarify if the previous comment is in the right direction. |
I would start from |
Also adds AllowShortCaseExpressionOnASingleLine option and AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements. Fixes llvm#55903.
Also adds AllowShortCaseExpressionOnASingleLine option and AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements. Fixes llvm#55903.
Also adds AllowShortCaseExpressionOnASingleLine option and AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements. Fixes llvm#55903.
Also adds AllowShortCaseExpressionOnASingleLine option and AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements. Fixes #55903.
I found that when attempting to format a Java file that contains an enhanced switch statement,
clang-format
will only format the code to the switch statement, but nothing below it.Below is an example code that hasn't been formatted yet, and has an enhanced switch statement. I've also included my configuration file. As a note, I'm using clang-format
14.0.4
.The text was updated successfully, but these errors were encountered: