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

未关闭
#1,866 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
2.3k
派生
547
平均合并
20 小时 1 分钟
30 天内合并 PR
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

  1. 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>)"
image

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用链接的 java-test 仓库和提供的 arrow-function 示例,在 VS Code 中复现诊断高亮。比较当前诊断和预期诊断,包括 arrow function 内部未定义的变量;完成标准是将语法错误定位出来,而不是高亮整个函数。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。