Wrong indentation on if-then with comments
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by inspecting the formatter source around line 331 and reproduce the reported snippet with a split if condition and trailing comment. Trace how indentation is calculated for the then block, then add or update coverage for this case and verify that the formatted output indents prd correctly.
Written by the indexing model from the issue text.
Description
Comments at the end of this if makes the then block to not get indented.
if (prd.source()
.isPresent()) // exclude generated productions like casts
prd = null;
Line 331. IntelliJ reports this as well.
I think the problem comes from the if condition that got split into two lines. If I move the comment to a separate line, then indentation works as expected.
- Dominant language
- Java
- Stars
- 6.2k
- Forks
- 936
- Avg merge
- 6m
- Merged PRs (30d)
- 3
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/google-java-format
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google/google-java-format#1094 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
google/google-java-format#1450 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
google/google-java-format#1439 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
google/google-java-format#1436 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
google/google-java-format#1428 · 4 comments ·
Maintainers usually reply within 1 day
All issues in google/google-java-format
Similar issues
-
and-bugs and-ui gpx-track
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 2 days
-
TerminalRow.mSpaceUsed (short) overflows on terminals wider than 1023 columns, crashing setCharOpen
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
termux/termux-app#5340 ·
Maintainers usually reply within 1 day
-
OpenAICompatibleToolDescriptorSchemaGenerator drops requiredProperties of nested object parametersOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/rocketmq-dashboard#5110 ·
Maintainers usually reply within 1 day
-
frontend
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
No-Country-simulation/S08-26-equipo04#210 ·
Maintainers usually reply within 1 day