google / google/google-java-format

Wrong indentation on if-then with comments

オープン
#1,009 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
6.2k
フォーク
937
平均マージ
6分
マージ済み PR(30日)
3

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。