redhat-developer / redhat-developer/vscode-java
Unable to suggest field name in the presence of annotation and compilation errors
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in VS Code with the Java extension: add a syntax error to an annotated method, then add a field and compare the name suggestion with the annotation removed. The issue is resolved when field-name suggestions still appear in the annotated case despite annotation and compilation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100