google / google/google-java-format

Wrong indentation on if-then with comments

Aperta
#1,009 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
6.2k
Fork
937
Merge medio
6m
PR unite (30g)
3

Descrizione

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;
```
![image](https://github.com/google/google-java-format/assets/5113255/80c7017d-27fb-4331-91f4-bee5394f2b60)
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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.