-
Notifications
You must be signed in to change notification settings - Fork 401
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
No need to run didOpen/didClose/didChange with scheduling rule #2637
No need to run didOpen/didClose/didChange with scheduling rule #2637
Conversation
5d20f93
to
350a184
Compare
I think it worth to give it a shot in the pre-release channel first. And keep an eye on two targets:
|
One more thing I forgot to mention is that using a scheduling rule in the didChange handler also has a negative impact on the debounce mechanism of the validation/diagnostics job. This is because the running validation/diagnostics job will lock the resource, and the next didChange will fail to acquire the lock and will not be able to cancel the previous validation/diagnostics job. |
Good point. We have monitored the uncaught exceptions from language client level, we can use that to verify the reliability status after this PR is merged. |
Could we got a step further (assuming no major issues) and not run the jobs in a workspace runnable, much like we attempted in #2449 ? Is there any greater risk of text changes being applied out of order when typing quickly (given that each |
Agree. Most document lifecycle operations do not modify the resource tree and do not require a workspace runnable. Only some rare cases need special handling. For instance, when an external Java file is opened, JLS will link it to the default project. We can handle such cases in a workspace runnable only.
There should be no problem. The document buffer update is done synchronously in the jsonrpc thread, and the changes are applied in the order they arrive. This is because You can see more information about Jobs API on https://www.eclipse.org/articles/Article-Concurrency/jobs-api.html. |
As discussed in #2518 and redhat-developer/vscode-java#3077 (comment), using scheduling rules in document lifecycle handlers can lead to deadlock and make the language server unresponsive during the build job. I propose to remove the scheduling rules from didOpen/didClose/didChange handlers for these reasons:
org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace()
and then typing code in Eclipse. So I think it should be ok for jdt.ls to follow the same approach on buffer synchronization of didChange handler.