The screenshot below shows an error on some non-existent code. The actual problem code was removed a few seconds ago, but the Java language server did not update the document properly. To fix the error, you can save the file and then type some empty lines. This issue happens randomly and does not occur every time.

After some debugging, I found out this is a regression introduced by #2320. That PR changed the code action calculator SimilarElementsRequestor.java so that the code action calculator will update the working copy buffer and interferes with the buffer sync in didChange handler.
To reproduce the issue consistently, follow these steps:
- Add a breakpoint at
|
if (cu.isWorkingCopy()) { |
- Open a Java file A.java and type some code until the breakpoint is hit
- Pause the breakpoint and continue typing a few more characters in A.java
- Resume the breakpoint
- Go back to A.java and type some code. You will see weird compilation errors due to the document being out-of-sync
The screenshot below shows an error on some non-existent code. The actual problem code was removed a few seconds ago, but the Java language server did not update the document properly. To fix the error, you can save the file and then type some empty lines. This issue happens randomly and does not occur every time.
After some debugging, I found out this is a regression introduced by #2320. That PR changed the code action calculator SimilarElementsRequestor.java so that the code action calculator will update the working copy buffer and interferes with the buffer sync in didChange handler.
To reproduce the issue consistently, follow these steps:
eclipse.jdt.ls/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SimilarElementsRequestor.java
Line 308 in fbd482b