redhat-developer / redhat-developer/vscode-java
Unable to suggest field name in the presence of annotation and compilation errors
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 547
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
Environment
- Operating System: Linux x64 5.4.28-1-MANJARO
- JDK version: OpenJDK 11.0.6
- Visual Studio Code version: 1.43.2
- Java extension version: 0.59.0
Hello!
This issue was first reported in the wrong repo (https://github.com/MicrosoftDocs/intellicode/issues/182), but disabling IntelliCode didn't affect the issue, so it was suggested the issue could be in vscode-java. Here it is:
Steps to Reproduce / Scenario:
- Create a class with a method and with an annotation on it. Do some syntax typo on that method.
- Add a new field on the class and wait for the field name suggestion.
- IntelliCode will not be able to suggest the field name.
If you comment out the annotation, it will suggest the field name just fine.
- Create a class with a method without any annotation on it. Do some syntax typo on that method.
- Add a new field on the class and wait for the field name suggestion.
- IntelliCode will suggest the field name just fine.
Here is a gif showing the issue:

This issue particularly bothers when developing with Spring Boot, which uses a lot of annotation. If I try to add a new field on an existent class that has methods with annotation, I'll not get proper name suggestion because while I'm typing private MyField and wait for the name suggestion, my code will already be invalid (with compilation errors), and because of that I'll not get the myField name suggestion.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 VS Code 中使用 Java extension 复现该问题:向带注解的方法添加语法错误,然后添加一个字段,并在移除注解后比较名称建议。如果即使存在注解和编译错误,带注解的情况下仍会显示字段名称建议,则问题已解决。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, typescript, vscode
- 领域
- devtools, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100