-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diagnostics delayed by 1 keystroke #26
Comments
The compilation unit being resolved here: https://github.com/MicroShed/jakarta-ls/blob/master/jakarta-eclipse/src/org/jakarta/jdt/JDTUtils.java#L111 is one keystroke behind the current document. This results in an empty diagnostics list: https://github.com/MicroShed/jakarta-ls/blob/master/jakarta-eclipse/src/org/jakarta/jdt/JDTServicesManager.java#L51-L53 |
I dont have much progress on this bug still. My thought is that, either is returning incorrect Ifile which I am not sure how to verify or it can possibly be |
Adding the following to https://github.com/MicroShed/jakarta-ls/blob/master/jakarta.ls/src/main/java/io/microshed/jakartals/JakartaLanguageServer.java#L41 will update diagnostics on save:
Keystroke delay still exists without saving |
Adding a delay before try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return JavaCore.createCompilationUnitFrom(resource); |
It appears public List<PublishDiagnosticsParams> getJavaDiagnostics(JakartaDiagnosticsParams javaParams) {
[...]
ICompilationUnit unit = JDTUtils.resolveCompilationUnit(u);
try {
while (!unit.isConsistent()) { }
} catch (JavaModelException e) { }
for (DiagnosticsCollector d : diagnosticsCollectors) {
d.collectDiagnostics(unit, diagnostics);
}
[...]
} Alternatively, the loop can be added to |
This looks great, thanks @tiganov! Any concerns with |
@kathrynkodama I haven't had issues with the while loop getting stuck, but I will put a timeout condition just in case. |
Closed with #201 |
Diagnostics added by #23 are always 1 keystroke behind.
The text was updated successfully, but these errors were encountered: