redhat-developer / redhat-developer/vscode-java
Java code formatter improperly formats one-liner conditions and loops, and after method signatures
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 2.3k
- フォーク
- 546
- 平均マージ
- 20時間 1分
- マージ済み PR(30日)
- 11
説明
The Java code formatter is working improperly after single-line conditions, loops, and specifically after multiline method signatures. For example, consider the following code segment:
public static List<List<Integer>> combinationSum(
int[] candidates, int target) {
return new ArrayList<>();
}
Now, if you hit Enter after the opening curly brace, the cursor will be jumped right to the next line with unexpected indentation:
Environment
- Operating System: Windows 10 22H2
- JDK version: javac 17.0.10
- Visual Studio Code version: 1.86.2
- Java extension version: 1.28.1
Steps To Reproduce
The brief information above represents just one example. Here is more with single-line conditions and loops:
Consider this code segment:
public static List<List<Integer>> combinationSum(
int[] candidates, int target) {
int x = 5;
if (x > 5)
System.out.println("ok");
else
System.out.println("Not ok");
return new ArrayList<>();
}
Have a look after the end of the else statement. It should not be indented in such cases.
Here is the screenshot:
The same goes with one-liner loops:
A sample file saved unformatted:
Main.zip
Log file generated by RedHat formatting server:
redhat_server_log.txt
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、コード例または添付された Main.zip を使ってインデントの問題を再現し、フォーマッターのコンテキストを確認するために redhat_server_log.txt を調べます。1 行の条件文とループ、および複数行のメソッドシグネチャの後の新しい行が、他のフォーマットに影響を与えることなく期待どおりにインデントされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100