redhat-developer / redhat-developer/vscode-java
If there's a syntax error inside an arrow function, the entire function is highlighted as an error in the editor
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 2.3k
- フォーク
- 546
- 平均マージ
- 20時間 1分
- マージ済み PR(30日)
- 11
説明
When an arrow function is assigned to a variable with a generic type parameter, and there is a syntax error inside the arrow function, VSCode highlights the entire arrow function as an error. This obscures the location of the syntax error and makes the code difficult to read.
Environment
Version: 1.54.3 (user setup)
Commit: 2b9aebd5354a3629c3aba0a5f5df49f43d6689f8
Date: 2021-03-15T10:55:45.459Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.18362
Steps To Reproduce
Repository: https://github.com/AnthonyWeston/java-test
- Add an arrow function with an undefined variable name inside it, and assign the function to a variable with a generic type parameter:
List<Integer> test = Stream.of("1", "2", "3")
.map(s -> {
int result = Integer.parseInt(s);
return oops;
})
.collect(Collectors.toList());
});
Current Result
VSCode highlights the entire arrow function as an error, obscuring the location of the undefined variable and making the code difficult to read. The error message is "Cannot infer type argument(s) for map(Function<? super T,? extends R>)"

Expected Result
Only the variable assignment is highlighted as an error, and the undefined variable is highlighted as an error and clearly visible.
Additional Information
Logs: https://github.com/AnthonyWeston/java-test/blob/main/log.log
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた java-test リポジトリと提供された arrow-function の例を使用して、VS Code での診断のハイライト表示を再現します。arrow function 内の未定義変数を含め、現在の診断と期待される診断を比較します。関数全体がハイライト表示されるのではなく、構文エラーが局所化されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java, vscode
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100